Professional Documents
Culture Documents
Functions
Introduction to functions
• A function is a group of statements that exist within a program for the
purpose of performing a specific task.
STEPS Pseudocode
Acme_dryer.py
Local Variables
• created inside a function
• cannot be accessed by
statements outside the
function
Scope
• The part of the program that can access the variable.
• A variable is visible only to statements in the variable’s scope.
• A variable cannot be accessed by code until the variable has been
created.
Participation Assignment
• Go to page 224 (birds.py)
THINK
• Read over the birds.py program
• On a piece of paper write down the order in which statements are
executed.
PAIR
• Group together and compare your answsers
SHARE
Passing Arguments
• Watch video in the Chapter 5 Moodle Book
Passing Multiple Arguments
Parameters vs Arguments
• Parameters are set up when you create a function.
• Arguments are what you pass into the function when it is called.