0% found this document useful (0 votes)
9 views

Python Psudo

Uploaded by

mike.saunders
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views

Python Psudo

Uploaded by

mike.saunders
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 11

Computer

Science
With: Mr Mike

https://www.techiemike.com
Pseudo code

Date: 9 October 2023

LO: How to write Pseudo code.

Success criteria: Students can write Pseudo code to create an algorithm.

https://www.techiemike.com
Pseudo code

Pseudo code is a simple method of showing an algorithm.

It describes what the algorithm does by using English key words that are very
similar to those used in a high-level programming language.

To ensure that pseudo code is easily understandable by others it is useful to be


consistent in the way that it is written.

https://www.techiemike.com
Pseudo code format

» a non-proportional font is used throughout

» 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

» where conditional and loop statements are used, repeated or selected


statements are indented by two spaces.

https://www.techiemike.com
Pseudo code format

A value is assigned to an item/variable using the operator.

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:

Cost 10 Cost has the value 10

Price Cost * 2 Price has the value 20

Tax Price * 0.12 Tax has the value 2.4

SellingPrice Price + Tax SellingPrice has the value 22.4

Gender "M" Gender has the value M

Chosen False Chosen has the value False

https://www.techiemike.com
Activity 7.6

Google classroom - todays lesson - Activity 7.6

Turn the activity in when you finish.

https://www.techiemike.com
The pseudo code for conditional statements

There are two types of conditional statement:

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

There are two types of conditional statement:

2 a choice between several different values, such as: CASE OF … OTHERWISE


… ENDCASE

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

2. How should key words be written in Pseudo code?

» Using capitol letters

3. What are the two types of conditional statements?


» IF
» CASE

4. What does the <- represent in Python and Pseudo code?


»=
» Assigned
5. How many indentations should you use in conditional statements?
»2
https://www.techiemike.com
Thank you.

In our next session we will discuss:

https://www.techiemike.com

You might also like