Kodewick
Start learning →
Starter←0 / 112

Stop at Four

#112Starterbreak3 min

The plan was to count from 1 to 9, but it should stop at 4. Show 1, 2, 3, 4, one per line, and nothing after that.

Leave range alone — do it inside the loop.

Should show
1
2
3
4
main.py
for n in range(1, 10):
    print(n)
    # your code here: if n is already 4, end the whole loop
Ctrl + Enter runs too
Result

Run tries the examples. When they look right, Submit.