Subroutine
s
20/02/202
5 trying to complete a set of research assignments.
You are
Which room is better equipped to help you
Extension – Explain why?
VALUES
Title: Subroutine – Functions & Procedures 20/02/2025 ATTITUDES
ATTRIBUTES
Literacy Key Words
Lesson objective: To understand that • Subroutine,
Functions,
code can be simplified using subroutines Procedures,
Arguments
SUCCESS CRITERIA - Depth of
Understanding
During this term, you will be looking at I do not know what a
python. Subroutines
Check your understanding by asking
ADVANCED
yourself the following each lesson: I have a slight Identify what COGNITIVE
PERFORMANCE
is a function
• Identify what is a function
• Describe what is a procedure
• Explain the difference between
5
Grade
I could accurately describe
what is procedure
the two I can Explain the difference
between a function &
• Create a program code using Procedure
functions and procedures
I can Create a program
code to create a function
with a procedure
Objectives and Outcomes
Create a program code to perform
a function stating the procedure
Stretch with an argument
Evaluate the difference between a
function and a procedure
Challenge
Identify what is a function in
python
Expected
I do not know what a Subroutines
KEYWORDS: Python, programming, Data Types, Operators, Import, Arithmetic
، عوامل التشغيل، أنواع البيانات، البرمجة، بايثون:الكلمات الرئيسية
الحساب، االستيراد키워드 : Python, 키
Activate – This is where you absorb information
What is a Why do we use
Procedure a Procedure
we use procedures to
A procedure
better organise our
can be
code so that finding
thought of as
errors and editing the
a mini
code can become
program or a
easier.
subroutine.
This is because major
It sits in the sections of our code is
background self-contained and
waiting to be separate from one
called. another
Activate – This is where you absorb information
Procedure Vs
functions
PLEASE NOTE: A procedure performs a task, whereas a
function produces information.
Functions differ from procedures in that functions return
values, unlike procedures which do not.
However, parameters can be passed to both procedures
and functions.
Activate – This is where you absorb information
Setting up a
procedure
Procedures sit at the top of our code.
The are declared using the ‘def’ command.
They are then given a name. Notice the
E.G.: brackets and
def procedure1(): colon!
The code for the procedure is then written
‘indented’ underneath.
‘def’ means to define (define a function (aka
method))
Activate – This is where you absorb information
Example of a
procedure
function
procedure
Lesson Objectives
• Identify what are libraries in python
• Evaluate the difference between a function and a procedure
• Create a program code that will use arithmetic methods
Activate – This is where you absorb information
Practice- Here is a model example
Lesson Objectives
• Identify what are libraries in python
• Evaluate the difference between a function and a procedure
• Create a program code that will use arithmetic methods
Demonstrate – This is where you apply and embed your knowledge
Expect
Create a subroutine that ask the user for their
name and then display their name with a
greeting.
Challenge
• Define a subprogram that will ask the user to
enter a number and save it as the variable
“num”. Define another subprogram that will
use “num” and count from 1 to that number
Demonstrate – This is where you apply and embed your knowledge
Stretc
h
Create a program that will create 3
procedures. The first procedure must allow the
user to input a low number and a high number,
it will then store a computer number which is a
random number between the two inputted
values.
Your second procedure must display a
message saying “I am thinking of a number
between” low and high and allow the user to
input a guess.
Third procedure is to check if the guess is
correct, if the guess is too low or too high a
prompt must be given to the user with the
option od guessing again.
Demonstrate – This is where you apply and embed your knowledge
Stretch
Plenary – Reflecting upon and reinforcing new learning
Define or give an example for the three words:
procedure
function
arguments