loop

Code that runs a block of statements repeatedly, either for each item of a collection or while a condition stays true.

In more detail

Python has two loop statements: for, which goes through a sequence, and while, which repeats until a condition becomes false. Common patterns built from them are the repeat loop, successive modification, accumulation and loops with a sentinel.

Related terms

Taught in

References

Certification courses