Python course · Chapter 6
Loops that count
for loops, range(), totals and counters.
Project: a times-table tester.
- 6.1Repeating with forA for loop runs the same lines again and again, so you don't have to copy them out.Start →
- 6.2Choosing the numbers: range()range() can start anywhere, stop anywhere, count in steps and count backwards.Open →
- 6.3Running totalsAdd up as you go: start a total at 0, add to it inside the loop, and print it at the end.Open →
- 6.4Counting thingsCount how many times something happens, and keep track of the biggest value so far.Open →
- 6.5Project: times-table testerPut the chapter together: print any times table, then build a program that tests you on it and keeps score.Open →
- CheckCheckpointFive mixed questions on for loops, with decisions, maths and f-strings mixed back in. Pass them all to finish the chapter.Open →