Definition
How do you write steps any programmer, in any language, can follow?
Pseudocode is an algorithm written in structured plain language, using a few keywords such as IF, ELSE, WHILE and FOR, without the strict rules of a real programming language. A flowchart shows the same algorithm as a diagram, using standard shapes connected by arrows.
In simple words
Pseudocode is like a recipe written neatly: each line is one step, and indented lines belong to the step above. A flowchart is the same recipe as a map you can follow with your finger. Every algorithm is built from three ideas: sequence (do this, then that), selection (if this, do that) and repetition (do this again).
Why it matters
Teams plan programs in pseudocode and flowcharts before writing code, and exams and interviews use them to test thinking without language details. Once you can write pseudocode, turning it into Python is mostly translation.
How it works
Pass or fail, in pseudocode
READ mark
IF mark >= 40 THEN
OUTPUT "Pass"
ELSE
OUTPUT "Fail"
END IF| Flowchart shape | Meaning |
|---|---|
| Rounded rectangle (oval) | Start or end |
| Parallelogram | Input or output |
| Rectangle | A process step, such as a calculation |
| Diamond | A decision with yes and no arrows |
| Arrow | The direction to go next |
The three building blocks
- Sequence: steps one after another.
- Selection: IF … ELSE, a diamond in a flowchart.
- Repetition: WHILE or FOR, an arrow that loops back.
Try it yourself
Match each shape to its meaning
Choose the meaning of each flowchart shape.
- Diamond
- Parallelogram
- Rectangle
- Oval
Turn a flowchart into pseudocode
The flowchart counts from 1 to 5. Put its pseudocode lines in order.
- 1SET count TO 1
- 2WHILE count <= 5
- 3 OUTPUT count
- 4END WHILE
- 5 SET count TO count + 1
Common mistakes
- Writing pseudocode so vague that it is just prose.
- Forgetting the 'no' arrow from a decision diamond.
- Creating a loop that never ends because the counter never changes.
Check yourself
Summary
- Pseudocode is structured plain language; flowcharts are the same steps as shapes.
- Sequence, selection and repetition build every algorithm.
- Good pseudocode translates almost line by line into Python.
Finished reading?