Skip to main content

Section 16.11 Review - Functions

Practice reading, tracing, testing, and writing simple functions.

Subsection 16.11.1 Part A: Recognize

Checkpoint 16.11.1.

Study the function below and label the function name, parameter, return statement, function call, and argument.
def double(value):
    return value * 2

result = double(5)

Subsection 16.11.2 Part B: Trace

Checkpoint 16.11.2.

def add_one(num):
    return num + 1
What value is returned by add_one(4), add_one(10), and add_one(-1)?

Subsection 16.11.3 Part C: Match

Checkpoint 16.11.3.

Subsection 16.11.4 Part D: Fix

Checkpoint 16.11.4.

Correct the errors in the function below.

Subsection 16.11.5 Part E: Create

Checkpoint 16.11.5.

Write a function named subtract that takes two parameters and returns the difference of the first minus the second. Then write three test calls.

Subsection 16.11.6 Think About ...

Checkpoint 16.11.6.

What is the difference between print() and return inside a function?
You have attempted of activities on this page.