Try it on paper first. A hint, the key idea and the worked solution are here when you need them.
Use a for loop to show the numbers from to , each on its own line.
range(1, 6) makes 1, 2, 3, 4 and 5.
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. We need the numbers 1, 2, 3, 4 and 5. The stop value is not included, so we write range(1, 6).
Check. The loop runs 5 times. The first value is 1 and the last is 5.
Log in to join the discussion.
Loading…