Community resourceWorksheet

J277 2.2.3 Functions, parameters and return values

Part 4 of 5 · J277 2.2.3 · Strings, arrays and functions

Functions, parameters and return values, and why parameters make one function reusable.

Students will:

  • define a function with parameters and call it with arguments
  • return a value and store the result
  • distinguish a parameter from an argument
  • return a Boolean result from a test
  • explain why parameters make a function reusable

Inside: 5 explanation cells, 3 runnable Python tasks, 2 multiple-choice questions, 1 fill-in-the-blanks cell and 2 written answers. 18 marks, about 45 minutes.

Series: J277 2.2.3 · Strings, arrays and functions, part 4 of 5.

Shared by Coding PathwayVerified teacher

  • 13 cells
  • About 45 minutes
  • CC BY-SA 4.0
  • Shared 17 Aug 2026
  • Updated 9 Sept 2026

Preview

The whole resource, exactly as a class sees it. Answers and marking are held back.

Functions, parameters and return values

A function is a named subprogram that returns a value. A parameter is a named value received by the function. An argument is the actual value supplied in a call. Parameters make one function reusable with different data. In Python, the keyword return sends a result back to the statement that called the function; print only displays a value.

Multiple choice1 mark

What should a function use to send a calculated value back to the part of the program that called it?

  • Ainput
  • Breturn
  • Cprint only
  • Da comment

Define, call and store

def calculate_area(length, width):
    area = length * width
    return area

room_area = calculate_area(6, 4)
Arguments entering a function and a returned value leaving it The arguments 6 and 4 are passed into the parameters length and width. The function calculates length times width and returns 24. The caller stores 24 in room_area. Arguments 6 and 4 supplied by caller calculate_area parameters: length, width return length × width Returned value 24 stored in room_area

length and width are parameters. 6 and 4 are arguments. The returned value is stored in room_area. A function requested to use parameters should not ask the user for fresh input inside the function.

Before running the next example, predict the two returned delivery costs. Trace each call separately and identify where each returned value is stored by the calling program.

Worked example
def delivery_cost(distance):
    if distance <= 5:
        cost = 2
    else:
        cost = 5
    return cost

first_cost = delivery_cost(3)
second_cost = delivery_cost(12)
print(first_cost, second_cost)
Fill in the blanks3 marks
A named input in a function definition is a label 1. A value supplied in a call is an label 2. The keyword label 3 sends a result back.
  • parameter
  • argument
  • return
  • print
  • constant

Supported practice: return the larger value

Complete larger(first, second) so it compares its two parameters and returns the greater value. Replace pass with a suitable if/else decision and return statements.

Do not ask for input inside the function: the caller supplies both values as arguments. The checks will call the function with the larger value in each parameter position.

Coding task4 marks
# Complete the function. It must return the larger of two parameters.
def larger(first, second):
    pass

result = larger(14, 9)
Multiple choice1 mark

Which call correctly stores the value returned by calculate_tax(50)?

  • Acalculate_tax = 50
  • Bprint = calculate_tax
  • Ctax = calculate_tax(50)
  • Dreturn calculate_tax

Independent practice: return a Boolean result

Write is_valid_age(age) with one parameter. It must return True for ages from 11 to 18 inclusive and False otherwise.

Use both inclusive boundaries and return a Boolean value rather than printing a message. The checks will call the function with both boundary values and an age outside the valid range.

Coding task4 marks
# Write a function named is_valid_age with one parameter.
# Return True for ages 11 to 18 inclusive, otherwise return False.
Written answer3 marks

Explain why replacing return area with print(area) can prevent the calling program from using the calculated area in a later calculation.

Contrast displaying a value with passing a value back to the caller.

Students type their answer here.

Written answer2 marks

A function is defined with a temperature parameter but also calls input() to ask for a new temperature. Explain why this weakens the design.

Refer to reuse, testing or the value supplied by the caller.

Students type their answer here.

Review

A reusable function receives data through parameters, performs one clear task and returns a value to its caller. Keep return distinct from print: returning makes a result available for assignment or further processing, while printing only displays it.