Lesson 3 of 4 · 6 min
Repeat with loops
Programmers never copy and paste the same line ten times. They use a loop.
A for loop repeats the indented lines underneath it. range(3) means: do this 3 times, counting 0, 1, 2.
Your turn: Count how many times the cheer is printed.
for i in range(3):
print("Hip hip hooray!")Quick check
If we change range(3) to range(5), how many cheers are printed?