Technology and Computer Science Computer Science

Function Machines: Parameters, Arguments and Return Values

Students trace short Python-style functions on paper, match key vocabulary, and write two small functions of their own.

Grades 8-1050 minutesSP-CS-010

THE GOAL

What students will learn

Students will trace calls to short functions by matching arguments to parameters, and will write two simple functions that return a value.

BEFORE THE BELL

Get ready

Copy the 2-page worksheet (one per student). Write the two-line example from the Before Class list on the board.

KEEP THE PLAN CLOSE

Your teacher guide

Teacher directions only. Student worksheets and the answer key are in the complete PDF.

SubstitutePlans.com
Technology and Computer Science · Computer Science
SP-CS-010 · Free to print and use in your classroom · substituteplans.com
Page 2
Function Machines: Parameters, Arguments
and Return Values
Technology and Computer Science · Computer Science · Grades 8-10 · 50 minutes
Time needed
50 minutes (one class period)
Prep
Copy the 2-page worksheet (one per student). Write the two-line example from the Before
Class list on the board.
Technology
None. No computers or devices are needed.
Student
independence
High. Students trace short Python-style functions on paper, then compare with a partner.
Copies to make
One 2-page worksheet per student
Materials
Pencils, Worksheet, Whiteboard or chalkboard
Goal for today: Students will trace calls to short functions by matching arguments to parameters, and will write two
simple functions that return a value.
Before the bell
☐ Copy the worksheet, one per student (2 pages).
☐ Write this on the board: def double(n): then on the next line (indented): return n * 2 and below it: double(7)
gives 14.
☐ Keep the answer key (the page after the worksheet) on your desk. You do not need to know any
programming to run this lesson.
☐ Tell students nobody needs a computer. Everything is traced with a pencil.
Say this to start
Good morning! Today is a computer science day with no computers. A function is like a small machine: you feed it a
value, it does a job, and it hands back one answer. You will act as the computer by tracing short pieces of code with a
pencil. Read the code carefully, follow it one step at a time, and write down exactly what it would give back.

SubstitutePlans.com
Technology and Computer Science · Computer Science
SP-CS-010 · Free to print and use in your classroom · substituteplans.com
Page 3
Run of show
Minutes
What you do
What students do
0–5
Take attendance. Hand out the worksheet and ask
students to read the code box at the top, but not to start
the questions yet.
Read the six lines of code in the box and
look at the board.
5–12
Point to the board example. Read aloud: “double takes a
number called n and returns n times 2. When we call
double(7), the 7 goes into n, so the machine hands back
14.” Ask: “What would double(10) give back?” (20).
Follow the example and answer the quick
question out loud.
12–18
Tell students to complete the matching section (questions
1–4). Walk the room while they work.
Match each vocabulary term to its
meaning.
18–33
Tell students to trace questions 5–12 in order. Remind
them to work from the inside out when one call is inside
another. Do not give answers yet.
Work out what each call returns and write
the answer on the blank.
33–42
Tell students to finish questions 13–16. Partners may
compare the two functions they write in 15 and 16.
Answer the two multiple-choice questions
and write two short functions.
42–47
Read the answers to questions 5–12 aloud from the key.
Students mark each one and fix mistakes in a different
color.
Check answers and correct them.
47–50
Collect all worksheets and stack them for the teacher.
Hand in the worksheet.
If things go wrong
• If students say they have not learned Python, tell them the code box and the board example are all they
need. Each function is just a small recipe: values go in, one value comes out.
• If a student is stuck on a nested call such as double(double(3)), tell them to solve the inside call first, write the
result, and then solve the outside call.
• If students finish very early, check that questions 15 and 16 are real functions with a def line and a return
line, then use the early finisher list.
• If a student asks about computers or phones, remind them the lesson is paper only and the class should stay
on the worksheet.
Early finishers
• Invent a function called square(n) that returns n times n. Write what square(9) returns.
• Write the output you expect for double(double(double(2))) and explain it in one sentence.
• Make up your own two-parameter function, such as one that adds two numbers, and trade with a neighbor to
trace it.
Support and challenge
• Support: Let students skip question 12 and write only the def line and the return line for questions 15 and 16,
using the board example as a model.
• Challenge: Ask students to write a function named hypotenuse_squared(a, b) that returns a squared plus b
squared, then trace hypotenuse_squared(3, 4).

SubstitutePlans.com
Technology and Computer Science · Computer Science
SP-CS-010 · Free to print and use in your classroom · substituteplans.com
Page 4
Notes for the teacher (you fill this in)
Jot a few lines before you leave. A full Daily Sub Report is in the free Sub Survival Kit at SubstitutePlans.com.
How far the class got / what to pick up next:
Students who were especially helpful:
Anything the teacher should know:

READY WHEN YOU ARE

Take the plan with you.

Teacher copy — includes the answer key.

The complete PDF includes welcome pages, substitute directions, student worksheets, and answers. Give students only the worksheet pages. Check the page labels before you print or share.

Download complete teacher PDF

Opens the PDF in a new tab. Use its print controls to select the student pages you need.

Download teacher phone guide

A readable guide that opens offline in your browser. Student worksheets and answers are not included.

Free lesson · SP-CS-006Guide ↓PDF ↓