Skip to content

Glossary: Python Basics

for loop

Also written: for

A loop that runs the same indented lines once for each item in a list, string, range or other collection. In `for item in cart:`, `item` holds each value in turn.

Where the book teaches it

Related terms

while loop