Python course · Chapter 6

Loops that count

for loops, range(), totals and counters.

Project: a times-table tester.

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