9_1_4

WHAT: Use a systematic approach to problem solving and algorithm creation representing those algorithms using pseudo-code and flowcharts.

HOW:

Activity 1 - PSEUDO CODE

Pseudo code is used to write an algorithm using formal language.

You will have written pseudo code already when you have written out an algorithm before coding it in Scratch or Python.

There is no "set way" to write pseudo code. The criteria for pseudo code is that it must be clear and precise.

Instructions change from being a sentence to being a precise instruction. For example,

A sentence...

Ask for some user input and store this in the variable name

becomes...

INPUT = Name

There are lots of other ways that this could be written but the key here is - is it clear and precise?

Activity 2

Convert these sentences into pseudo code:

  • Ask for some user input and store this in the age variable
  • Take the age variable and multiply this by 2
  • Print the new age variable on the screen as output

Activity 3

Here is some pseudo code for a solution. Use this pseudo code to create an application in Python or Scratch.

guess=""
answer=YES
play=guess NOT EQUAL TO answer
WHILE play is TRUE
    INPUT = guess
    play=guess NOT EQUAL TO answer
END WHILE
OUTPUT Correct

Activity 4 - FLOW CHARTS

Flow charts can be used to represent algorithms by clearly showing the flow of data. You may find it easier to use flow charts instead of pseudo code or vice versa.

The pseudo code in activity 3 can be represented as a flow chart like the one below (note that diamond shapes are used when a decision needs to be made):

Activity 5

Turn the pseudo code that you created for Activity 2 into a flow chart.

CHECK:

EMBED:

Use the computational thinking problem solver to solve the problem below. Focus on making sure that your algorithm is precise and is represented as pseudo code or a flow chart.

PROBLEM:

A teacher wants to make a guess the number game for her class. It will need to check the student guess and let them know if they are correct. The number that the student needs to guess should be a random number between 0 and 10.

The program should:

Ask for their guess and store it in an appropriately named variable

Check if their guess is correct

If the student is correct it should output well done

If the student is incorrect then it should say Higher or Lower

The game should continue until the student has guessed correctly

At the end of the game, the program should output the number of guesses taken

CLASSROOM IDEAS:

The students might need lots of practice before they fully understand how to write pseudo code or flow charts. Keep giving them lots of problems to solve to help them really practice the skill.