A wizard never writes the same spell 100 times. That's boring! 😴
Instead, we use a Loop. It tells the computer: "Do this part X times". It's like time travel, going back to the start of the line!
This spell repeats code 5 times.
i is a variable that counts for you. It starts at 0.range(5) counts: 0, 1, 2, 3, 4. (It stops before 5!)
Make the computer print "I am coding!" 5 times using a loop.
for i in range(5):
print("I am coding!")
Now let's see the invisible number! Print the variable i inside the loop.
Check if it goes from 0 to 4.
for i in range(5):
print(i)
Computers are fast. Print i * 100 inside the loop.
It should show 0, 100, 200, 300, 400!
1. range(3) counts which numbers?