0 / 2 embers
0 / 3000 xp
click for more info
Complete a lesson to start your streak
click for more info
Difficulty: 3
click for more info
No active XP Potion
Accept a Quest
Login to submit answers
As a reminder, a "for loop" in Python is written like this:
for i in range(0, 10):
print(i)
In English, the code says:
i
equals 0
. (i in range(0)
)i
is greater than or equal to 10 (range(0, 10)
), exit the loop.i
to the console. (print(i)
)1
to i
. (range
defaults to incrementing by 1)2
The result is that the numbers 0-9
are logged to the console in order.
The body of a for-loop must be indented; otherwise, you'll get a syntax error.
In the print_numbers
function, write a for-loop from scratch that logs the numbers 0-199 to the console.
Focus Editor
Alt+Shift+]
Become a member to Submit
Become a member to Run
Become a member to view solution