Back to marketplace

Sub-Programs

No description yet. This curated deck is ready for daily study.

Total cards: 5•Content version: v4•Public deck•Updated: 8/1/2026

Card preview (5)

#1
Front (Question)

How to create a sub-program in Python:

Back (Answer)

1 - define it by using ‘def’. 2 - give it a name e.g message 1 3 - the code we then want to be part of the sub-program is indented

#2
Front (Question)

How to call a sub-program in Python

Back (Answer)

• By writing out the name of the sub-programs e.g message1 and adding brackets represents us wanting the code inside those sub-programs to execute.

#3
Front (Question)

Parameters

Back (Answer)

• A variable that is used as an input to the sub-program.

#4
Front (Question)

Example of parameters in sub-programs using a simple addition program where the user inputs two numbers.

Back (Answer)

• def addition (x, y): • z = x + y • print(z) • x = int(input(“Please enter your first number - “) • y = int(input(“Please enter your second number - “) • addition(x,y)

#5
Front (Question)

Function vs Procedure

Back (Answer)

• A function returns a value • A procedure does not return a value