Back to Python course
PyControl FlowBeginnerLive Python12 min
For Loops
Repeat an action for every item in a sequence.
Explanation cell
A for loop repeats code for every item in a sequence. It is useful for processing lists, files and data.
iterationlistsrepeated actions
Quick tip
The indented lines inside a loop run once for each item.
Common mistake
Make sure the line inside the loop is indented.
Code cell
Starter code · Ctrl+Enter runs · Ctrl+Shift+Enter tests
Python runtime loads on first run
Output cell
Run your code to see output.
Run your code to see output.
Test cell
Tests run against the actual Python output.
Run tests to check your code against the lesson goals.
Practice cell
Try this
Print each tool in lowercase.
Expected output
PDF
CSV
JSON