Python Psudo
Python Psudo
Science
With: Mr Mike
https://www.techiemike.com
Pseudo code
https://www.techiemike.com
Pseudo code
It describes what the algorithm does by using English key words that are very
similar to those used in a high-level programming language.
https://www.techiemike.com
Pseudo code format
» all keywords (words used to describe a specific action e.g. INPUT) are written
in capital letters
» all names given to data items and subroutines start with a capital letter
https://www.techiemike.com
Pseudo code format
The variable on the left of the is assigned the value of the expression on the
right.
https://www.techiemike.com
Examples of pseudo code assignment statements:
https://www.techiemike.com
Activity 7.6
https://www.techiemike.com
The pseudo code for conditional statements
1 a condition that can be true or false such as: IF … THEN … ELSE … ENDIF
IF Age < 18
THEN
OUTPUT "Child"
ELSE
OUTPUT "Adult"
ENDIF
https://www.techiemike.com
The pseudo code for conditional statements
CASE OF Grade
"A" : OUTPUT "Excellent"
"B" : OUTPUT "Good"
"C" : OUTPUT "Average"
OTHERWISE OUTPUT "Improvement is needed"
ENDCASE
https://www.techiemike.com
Pop Quiz
1. What is Pseudo code used for?
» a method of showing an algorithm
https://www.techiemike.com