All lessons

Computer Science

Writing pseudocode so a human can follow every step with only one meaning

Listen

Pseudocode uses plain lines with exactly one meaning each. It is not Python syntax. Judging whether a step is unambiguous is the core skill here; counting how efficient an algorithm is comes later. No passwords in the lesson chat, and no real knives if you act out the sandwich example.

What you will learn

  • Write pseudocode steps in plain language so that every reader follows them the same way
  • Explain why a vague word like "somehow" makes a step fail as an algorithm
  • Distinguish writing unambiguous pseudocode from measuring how efficient an algorithm is

Pseudocode is an algorithm written in careful plain language, not in a real language's punctuation. Each line has one meaning. IF and REPEAT are allowed as words. "Make a sandwich somehow" fails because somehow can mean anything. "Take one slice of bread, then spread peanut butter on that slice" can be followed.

In this lesson you will design plain-language steps and judge whether each line is unambiguous. You do not need Python syntax here.

Do not use a real knife if you act out the sandwich example. Do not type any passwords into the lesson chat.

Key words

pseudocode
An algorithm written in careful plain language, not in a real programming language.
unambiguous step
A line that two readers would carry out the same way.

Check yourself

Pseudocode here is —

"Make a sandwich somehow" fails because —

Think about it

Where in your daily routine do you already follow an algorithm without naming it?