Basic

Reading & drawing flowcharts

Use shapes and arrows to sketch how a process or program flows before writing any code.

What you will see

Run 3 Run 2 Run 1 End

About 2 min of reading

Quick check

Before this new lesson, one small question about the lesson you just finished. Recall it, do not look it up.

Try It

A flowchart moves through steps, crosses a decision diamond, then follows a branch until it ends. I draw each piece in runnable Python: a straight sequence, a yes/no check, and a loop that circles back.

1

I follow a straight path with no decisions, each action runs in order, exactly like the rectangles of a flowchart joined by single arrows, so the output is a clean sequence.

path = ["Read input", "Validate", "Save", "Done"] for item in path: print(item)

Before you run it, say out loud what it will print. Then open the answer.

What it prints
Read input Validate Save Done
A pure sequence never branches. Arrows point only forward, so every step runs in order.
2

I reach a decision diamond and evaluate the condition. The result is either True or False, and the matching branch is the one the flowchart takes from here on.

age = 20 can_enter = age >= 18 print(f"Adult ({age} >= 18): {can_enter}")

Before you run it, say out loud what it will print. Then open the answer.

What it prints
Adult (20 >= 18): True
A diamond always has an exit for each branch. If one branch leads nowhere, the diagram never finishes.
3

I hit a loop where an arrow circles back. The body runs while the condition stays true, counting down each pass, then I print the end to show the loop terminates on its own.

count = 3 while count > 0: print(f"Run {count}") count = count - 1 print("End")

Before you run it, say out loud what it will print. Then open the answer.

What it prints
Run 3 Run 2 Run 1 End
A while loop needs something inside it to eventually break the condition, or it runs forever. Here count drops each round.

Put it in order

Before you write anything, put these lines back in the right order. Click a line to move it up one step. This support step is easier than writing code from scratch, and it is here to make the last example stick.

Data Flow

A flow moves through steps, hits a decision, and follows the matching branch until it reaches the end.
1 Start at the rounded rectangle
↓
2 Follow arrows down through each action
↓
3 Reach a diamond -> pick yes or no
↓
4 Repeat until an end shape is reached
Why this works
Reading a decision diamond

Every diamond has (usually) two exits: yes and no. Both branches must eventually rejoin or end, otherwise the diagram never finishes.

{ score >= 60? }
   |\n  yes  no
   |     \
   v      \
[ Pass ]  [ Fail ]
   \      /
    \    /
      [ End ]

A flowchart with a branch that leads nowhere is a bug waiting to happen.

Sequences, choices, loops

Three control structures appear in every flowchart:

  • **Sequence*: steps in a straight line.
  • **Choice*: the diamond that splits the path.
  • **Loop*: an arrow that circles back to repeat steps.

[ Do task ]
   |
   v
{ Finished? }
   |\n  no  (back up to the task)
   yes
   v
[ End ]

Loops are how you avoid drawing the same steps over and over.

Examples

The common shapes

Symbols you need to know

Flowcharts use a small set of shapes:

ShapeMeaning
Rounded rectStart / End
RectangleA step or action
DiamondA decision (yes/no)
ParallelogramInput / Output
ArrowDirection of flow

[ Start ]
   |
   v
[ Read input ]
   |
   v
{ Is it valid? }

Once you learn these five shapes you can draw almost any process.

Drawing a coffee machine

Modelling a simple process

Picture a coffee machine:

[ Start ]
   |
   v
[ Add water ]
   |
   v
{ Enough water? }
   |\n  no
   v      \
[ Alert ]   \
             \
   yes        \
   |            \
   v             \
[ Brew coffee ]  \
   |              \
   v               \
[ Done ] <---------

Why it works: the diamond forces you to decide a branch before continuing.

Words this lesson uses

Each one is defined here on this site. Open the entry for the full definition and the other words it points at.

← What is computational thinking?
Previous Lesson
What is computational thinking?
Next Lesson
Writing pseudocode
Writing pseudocode →