Functions – Parameters, online

Six activities your students do on their own devices. See who's finished, and their scores.

Functions – Parameters in one minute

What students need to know

'Alice' is passed as the argument for the parameter 'name'. Multiple parameters are separated by commas in the def line.

Parameters are the names in the def line — they receive the argument values. Arguments are the values you pass when calling the function.

Mistakes students make

  • Missing colon after the parameter list.
  • Parameters don't use quotes: name is a variable, not a string.
  • Multiple parameters must be separated by commas.
  • Missing argument: greet expects a name but got nothing.

Discover other journeys with this module

What students will learn in this module

Every question in Module 25

Quick questions

  1. What is a parameter?AThe function nameBA variable in the function definition
  2. What is an argument?AThe actual value passed to a functionBThe function name
  3. def greet(name):\n print('Hi ' + name)\ngreet('Bob')\nWhat prints?AHi BobBHi name
  4. def add(a, b):\n print(a + b)\nadd(3, 5)\nWhat prints?A35B8
  5. Can a function have multiple parameters?AYes separated by commasBNo only one

Key terms

Students type the meaning of:

  • Parameter
  • Argument
  • def greet(name):
  • greet('Alice')

Match the pairs

def add(a, b):
    return a + b
add(3)
Match it to what it does
def greet(name):
    print('Hi ' + name)
greet('Al', 'Bob')
Match it to what it does
def greet(name):
    print('Hi ' + name)
greet('Alice')
Match it to what it does
def add(a, b):
    return a + b
Match it to what it does
def square(n):
    return n * n
print(square(4))
Match it to what it does
def add(a, b):
    return a + b
print(add(3, 5))
Match it to what it does

Fill in the blanks

  1. def greet(____):
        print('Hi ' + name)
    
    greet('Alice')
  2. def add(a, _):
        print(a + b)
    
    add(3, 5)
  3. def greet(name):
        print('Hi ' + name)
    
    greet(_____)
  4. def double(______):
        print(number * 2)
    
    double(5)
  5. def show(x, y):
        print(x + y)
    
    show(_, 10)

Spot the error

Question 1

Adef greet(name)B    msg = 'Hi ' + nameC    print(msg)D    print('Goodbye!')Egreet('Alice')

Question 2

Adef greet('name'):B    msg = 'Hi ' + nameC    print(msg)D    print('Goodbye!')Egreet('Alice')

Question 3

Adef add(a b):B    result = a + bC    print('Sum:', result)D    return resultEadd(3, 5)

Question 4

Adef greet(name):B    print('Hi ' + name)CDgreet()

Question 5

Adef greet(name):B    print('Hi ' + name)CDgreet('Alice', 'Bob')