Python course · Chapter 7
Loops that wait
while loops, checking input, stopping with break.
Project: guess the number.
- 7.1Repeating with whileA while loop keeps going as long as something is True, however many times that takes.Start →
- 7.2Checking inputKeep asking until the user types something sensible. This is called validation.Open →
- 7.3Stopping with breakbreak jumps straight out of a loop, so a loop can stop in the middle when something happens.Open →
- 7.4For or while?Use for when you know how many times; use while when you're waiting for something to happen.Open →
- 7.5Project: guess the numberPut the chapter together: a guessing game that says higher or lower and counts your guesses.Open →
- CheckCheckpointFive mixed questions on while loops, validation and break, with earlier chapters mixed back in. Pass them all to finish the chapter.Open →