Lesson 7 — Functions
Reusable blocks
A function packages code under a name so you can run it again and again by "calling" it. It can take inputs (parameters) and hand back a result with return.
Why it matters: functions keep code short, organised and easy to fix — write the logic once, reuse it everywhere.
Watch out: return sends a value back to the caller; print() only shows it. They are not the same.
Write add(a, b) that returns a + b, then print add(2, 3).
Ready for more? These paid resources pick up where this lesson leaves off.
Project-based Python Foundations video courses — the perfect paid next step after these free lessons.
Browse on Udemy →Hand-picked Python Foundations books to master the fundamentals offline.
See on Amazon →Some links on this page are affiliate links: we may earn a commission at no extra cost to you. We only recommend tools we believe are genuinely useful.