Python Quest

Track 4 · Lesson 7 of 11

break, continue and the loop else

Leave a loop early with break, skip the rest of one iteration with continue, and use a loop's else clause to handle 'not found'.

About 35 minIntermediate4 exercises

You will be able to

  • Stop a loop as soon as the answer is known with break
  • Skip unwanted items with continue
  • Write a while True loop that ends with break
  • Use else on a loop to run code only when no break happened

Included with a Formula Quest membership

It has 4 graded exercises with feedback, hints and solutions. Python Quest is included in Formula Quest memberships that cover Python; membership and billing are managed on Formula Quest.

View Formula Quest memberships

Tracks 1 and 2, the first lesson of every track, the playground and the dataset library are free.