Repeat After Me ๐
Want to print something 5 times? You could write five print() lines.
Or you could make Python do it:
for i in range(5):
print("Python is cool! ๐")
That's a for loop. It means "do the indented part 5 times."
Look closely, because the shape is the same as if:
- The
forline ends with a colon: - The next line is indented โ that's the part that repeats
range(5) is Python counting out five turns for you. Change the number,
change how many times it runs. range(100) would run it a hundred times,
and you'd still only write two lines. ๐
Your mission
- Use a
forloop withrange()to print a message exactly 7 times - The message is totally up to you
Your code
Press โถ Run to see what your code does!