Python

For Loops

for loops repeat code for each item in a sequence.

for i in range(5):
    print(i)  # Prints 0, 1, 2, 3, 4

range() Function

CodeResult
range(5)0, 1, 2, 3, 4
range(1, 6)1, 2, 3, 4, 5
range(0, 10, 2)0, 2, 4, 6, 8

Your Task

Print numbers 1 through 5, each on a new line.

script.py
Loading PYTHON engine...
Downloading Python… (one-time, ~10 MB)

Downloading Python… (one-time, ~10 MB)

This runs entirely in your browser and is cached for next time.