GCSE Python · Lesson 6 of 9Functions, parameters and returns
OCR J277 2.2 / AQA 8525 programming
Use reusable functions to calculate average and assign a category.
← All GCSE Python lessons Functions in larger programs
Separating input, calculation and display into functions makes a program easier to test. Use parameters to pass information and return values to share results with the caller. Identify which variables belong to each function.
Watch out: Avoid relying on global variables for every result. Passing data explicitly makes subroutines easier to reuse and debug.
A free TutorSyntax programming lesson. About our teaching approach.
APPLY THE IDEA
Use this skill beyond the example
Choose a descriptive function name and one clear job for each function. Compare examples using parameters and return values with those relying on global state, and test the function independently.
Quick check: What is a benefit of returning a result?
Check: The caller can store or reuse the result in another expression or function.
Continue with related practice →