Specialty Digest

Global English editionLearners’ Study Dashboard — in development
The Knowledge Library for All

Online Courses / University Track / Python from Zero

Module 3 of 8

Repetition: for and while Loops

Make a program repeat work without repeating code. Use for loops to count, while loops to wait for a condition, and a total, a counter and a trace table to check your loops.

  • 6 hours
  • Outcomes O3
  • Checkpoint: 80% to unlock Module 4

Big idea. A loop repeats lines until it runs out of values or its condition becomes False, and the variables that change inside it carry the result.

Outcomes served. O3 (write programs that repeat work and make decisions).

Plan your six hours

Assumed. Modules 1 and 2: variables, arithmetic, input, comparisons and if statements.

Where this topic appears in practice. Loops add up a month of sales, check every row of a file, keep asking until an entry is valid and process a thousand records with ten lines of code.

Privacy. Your answers stay with you. This course does not store, collect or send anything you write or tick.