Pseudocode
  1. What is pseudocode?
  2. Why is it used?
  3. How do we write pseudocode?

Can you place block A next to block B?

Key Definition – Pseudocode

ic_action_edit Pseudo-code is a simple text-based system for describing an algorithm or set of instructions, free from the restrictions and requirements of a particular language.

Pseudo-code is …

…non-standardised

Pseudocode can look similar to code but it does not need to follow the rules of a particular language.

…used to develop algorithms before coding

This means you can develop algorithms quickly without worrying whether your script will work with a particular programming language.

…easily converted in to a number of different languages.

pseudocode-to-pythonscratch

 

Rules – What Rules?!?

There are no set rules for writing pseudocode, but you will often see the following:

  • INPUT – indicates a user will be inputting something
  • OUTPUT – indicates that an output will appear on the screen
  • WHILE – a loop (iteration that has a condition at the beginning)
  • FOR – a counting loop (iteration)
  • REPEAT – UNTIL – a loop (iteration) that has a condition at the end
  • IF – THEN – ELSE – a decision (selection) in which a choice is made
  • any instructions that occur inside a selection or iteration are usually indented

source: bbc.co.uk

Challenge 1 – Double the number

Write a pseudo-code algorithm that asks the user for a number, doubles and then displays the number.

Challenge 2 – Calculate the area of a circle

Write a pseudo-code algorithm that asks the user for the radius of a circle and then displays the area of the circle.

Challenge 3 – Calculate the circumference of a rectangle.

Write a pseudo-code algorithm that asks the user for the length and width of a rectangle and then displays the circumference of the rectangle.

 

checklist2

Have you?

  • Completed the starter activity?

  • Completed each of the challenges?

  • Completed the learning log?

  • Written your homework on your planner?

homework.01

Complete the quiz assignment on quizmaster- “Algorithms Topic 1-2 Quiz”