Loops
Loops: Do It Again! 🔁
What if you need to repeat something many times — print 100 numbers, or check every letter in a word? You don't write the same line 100 times. You use a loop.
Python has two kinds of loops:
for— repeat once for each item in a range (or a string, a list, or a dictionary)while— repeat as long as a condition staysTrue
(Python doesn't have a do-while loop like some other languages — for and while cover everything you'll need.)
This unit also covers two loop "control" keywords, break and continue, and the accumulator pattern — one of the most useful things you'll ever do inside a loop.