Loops let you repeat actions until a condition is met or you finish iterating over a collection.
for
LoopThe for
loop is used to iterate over a sequence like a list or range.
while
Loopwhile
loops keep running as long as the condition is True
.
break
and continue
break
stops the loop early, continue
skips to the next iteration.
while
loops! Always make sure the condition can become False
.