Try it on paper first. A hint, the key idea and the worked solution are here when you need them.
Count down from to , and then show Go!
A negative step counts down, and the stop value is still not included.
Have you tried it?
Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, compare your working with the solution.
Plan. A countdown needs a negative step: range(5, 0, -1) makes 5, 4, 3, 2, 1. It stops before 0.
The line print("Go!") is not indented, so it runs once, after the loop.
Log in to join the discussion.
Loading…