2. Printing from 1 to 3

2.1. Simple way

1print(1)
2print(2)
3print(3)
line that just executed

next line to execute

Print output (drag lower right corner to resize)
Frames
Objects

Activity: CodeLens 2.1.1 (cl_l15_2a_en)

2.2. Using a variable

1x = 1
2print(x)
3x = 2
4print(x)
5x = 3
6print(x)
line that just executed

next line to execute

Print output (drag lower right corner to resize)
Frames
Objects

Activity: CodeLens 2.2.1 (cl_l15_2b_en)

2.3. Incrementing the variable

1x = 1
2print(x)
3x = x + 1
4print(x)
5x = x + 1
6print(x)
line that just executed

next line to execute

Print output (drag lower right corner to resize)
Frames
Objects

Activity: CodeLens 2.3.1 (cl_l15_2c_en)

2.4. Using while

1x = 1
2while x <= 3:
3    print(x)
4    x = x +1
line that just executed

next line to execute

Print output (drag lower right corner to resize)
Frames
Objects

Activity: CodeLens 2.4.1 (cl_l15_2d_en)

2.4.1. Desk checking

x = 1
while x <= 3:
    print(x)
    x = x + 1
Desk checking

x

Screen

-1-

1

-2-

2

-3-

3

4

1x = 1
2while x <= 3:
3    print(x)
4    x = x + 1
line that just executed

next line to execute

Print output (drag lower right corner to resize)
Frames
Objects

Activity: CodeLens 2.4.1.1 (cl_l15_2e_en)

You have attempted 1 of 2 activities on this page