Sign in

Intro to Computer Science / Unit 3: Algorithms and Problem Solving

3.3 Pseudocode

3 practice questionsNot yet reviewed

Notes

Pseudocode is a plain-language way to describe an algorithm without worrying about exact programming syntax.

  • Use clear action words: INPUT, SET, IF, ELSE, REPEAT, PRINT.
  • Indent steps inside a decision or loop.
  • Example (find the larger of two numbers):
INPUT a
INPUT b
IF a > b THEN
PRINT a
ELSE
PRINT b
  • Pseudocode is for people. Python or another language is for the computer.
  • Trace it: if a is 4 and b is 9, then a > b is false, so it prints 9.

Practice

What is pseudocode?
In the pseudocode above, what is printed when a is 10 and b is 3?
Which pseudocode correctly describes finding the total of three numbers x, y and z?

Ready for more? Take the Unit 3 test.