T1-R3 in five minutes
A function takes an input and returns an output.
Strings, numbers, lists, and dicts cover the labs.
A pure function is easier to test than a hidden global.
Name the unit: tokens, milliseconds, or documents.
Print the value and the unit together.
Agent code fails when a function both computes and secretly sends data. Split the calculation from the side effect so a test can call the calculation alone.
Sources and go deeper
- Python 3 tutorial vendor last checked 2026-10
- Python.org community community last checked 2026-10
- Python (programming language) — Wikipedia wikipedia last checked 2026-10