Professional Documents
Culture Documents
Python L4 Writing Algorithms
Python L4 Writing Algorithms
Writing Pseudocode
• Pseudocode is half code, half English
• It has no real syntax and would not run
• It is a structured sequence of instructions
• It is useful for planning algorithms
Pseudocode Example:
Writing an Algorithm
• Write a pseudocode algorithm to display the correct
hat size based on the circumference of your head:
Task
• You must construct pseudocode that will select
seasons “Spring, Summer, Autumn, Winter” dependent
on each covering 3 months?
• You must now code the above pseudocode to see if it
works;
Tips
• You must show an ‘else’ if the input is incorrect;
• You can use the ‘elif’ function.
Introduction to Python
Writing algorithms
Answer:
Introduction to Python
Writing algorithms
Debugging exercise
• Look at the two programs below and see if you can
find and correct the errors in them
SeasonFinderBUGS.py
TaxCalculatorBUGS.py