Back to the lesson: Loops
While Counts to Three
The exercise
A while loop repeats while its condition is true. Here the last line is unfinished: the counter n must grow by 1 on every pass, otherwise the loop would never stop. Finish the line so the program shows 1, 2, 3.
Example output:
1
2
3
Starter code
n = 1
while n <= 3:
print(n)
n = n +
Write the code in the browser and run it — no installation needed.