Algorithms


Below are some comparisons of how to achieve the same thing in a flowchart, pseudocode & Python.

This site was originally written using AQA suggested pseudocode, but will be updated to include OCR recommendations.
It will aso be extended, to include a lot more examples.

Comparison

Topic FlowChart PseudoCode Python
Assigning a variable Assignment a ← 5 a = 5
Input Input a ← USERINPUT a = input()
Output Output OUTPUT a print(a)
Subtraction Subtraction a ← b - c a = b - c
Selection:
Greater than
Selection-GT IF a > b THEN
 funcA()
ELSE
 funcB()
ENDIF
if a > b:
 funcA()
else:
 funcB()
Selection:
Less than
Selection-LT IF a < b THEN
 funcA()
ELSE
 funcB()
ENDIF
if a < b:
 funcA()
else:
 funcB()
Selection:
Equal to
Selection-EQ IF a = b THEN
 funcA()
ELSE
 funcB()
ENDIF
if a == b:
 funcA()
else:
 funcB()
Selection:
Not equal to
Selection-NEQ IF a ≠ b THEN
 funcA()
ELSE
 funcB()
ENDIF
if a != b:
 funcA()
else:
 funcB()
Iteration:
While loop
Iteration-WHILE WHILE a ≠ b
 OUTPUT b
 a ← USERINPUT
ENDWHILE
while a != b:
 print(b)
 a = input()
Iteration:
For loop (count-up)
Iteration-FOR_UP FOR i ← 0 TO 9
 OUTPUT i
ENDFOR
for i in range(10):
 print(i)
Iteration:
For loop (count-down)
Iteration-FOR_DOWN FOR i ← 10 TO 1
 OUTPUT i
ENDFOR
for i in range(10, 0, -1):
 print(i)

Some useful Pseudocode links.

  1. PseudoCode CheatSheet
  2. PseudoWars
  3. AQA PseudoCode Guidelines