Python Foundations · Lesson 10 of 12Subroutines and parameters
Defining functions, arguments and return values. Learn through short examples, practical tasks and targeted questions.
← All lessons
Writing reusable functions
Functions divide programs into manageable parts. Parameters accept values supplied by the caller; return sends a result back for use elsewhere. Compare printing a result with returning it—only the returned value can be directly used in another calculation.
Watch out: A function that prints a value does not automatically return it. In Python, functions without an explicit return produce None.
A free TutorSyntax programming lesson. About our teaching approach.
APPLY THE IDEA
Use this skill beyond the example
When you call a function, distinguish the argument sent by the caller from the parameter name used inside the function. Check whether the function prints a result or returns it; those actions are not interchangeable.
Quick check: Why can a function that only prints a result be hard to use in a calculation?
Check: Printing displays output but does not return the computed value to the caller.
Continue with related practice →