ACTIVITY 21 / 50
Try as many times as you needRepeat a set number of times
Let’s understand
for steps through a sequence. range(3) gives 0, 1, 2: the end is excluded. range(1, 4) gives 1, 2, 3. The loop variable takes the next number each time.
Listen to the explanation
Example
for i in range(2):
print("PING")Print SCAN four times on separate lines using for.
I need a hint
range(4) gives four repetitions.
How to find an error
- Read the last line of the error message.
- Find the indicated line. Check quotes, parentheses and indentation.
- Change one thing and run again.
main.py
4 spaces
Your draft stays in this browser.
Result
PythonYour program’s output will appear here. Click Run.
Мой профиль