Professional Documents
Culture Documents
Sub Programs
Sub Programs
What is a subprogram
It is a self-contained module of code that performs a specific task.
Subprogram
Function Procedure
A block of code which only runs when it is Allows us to group a block of code under a
called. name
Can pass data known as parameters or Can pass the parameters and arguments
arguments into a function
Can return data Can't return data
Function
Pseudocode Description Python
FUNCTION dice () def dice ()
SET simdie TO RANDOM simdie = random.radint(1,7)
(6) return simdie
RETURN simdie
END FUNCTION
diethrow = dice ()
Procedure
Pseudocode Python
PROCEDURE dice () def dice ()
SET simdie TO RANDOM (6) simdie = random.radint(1,7)
SEND simdie TO DISPLAY print(simdie)
END PROCEDURE