MicrolearnENPTES

while loops

Lesson 10 of 20 · Py.Micro

Repeat while a condition stays true, for when you do not know how many times.

Savings grow 10% a year: how many years to double? We do not know the count in advance, so while keeps going until the goal is reached.

Check yourself

When does a while loop stop?

Do it in the browser: a real Python tool, a short mission and instant feedback. No install.

Start this lesson — free
← for and rangeAccumulating →

All lessons · Py.Micro