Flow Diagrams
Represent an algorithm visually using standard symbols and connected paths.
A flow diagram, also called a flowchart, shows how an algorithm moves from one step to the next. The shapes tell you what kind of step is happening, while the connecting lines show the route through the algorithm.
Predict
Follow the diagram before running any code. For each input, predict which message will be produced.
- What is output if the input is
14? - What is output if the input is
19? - What does the diamond decide?
- Why must both paths eventually reach End?
Run
Now run the Python version. Try the same values you used in your prediction.
number = int(input("Number: "))
if number % 2 == 0:
print("Even")
else:
print("Odd")- Run the program with
14and19. - Does the result match the path you followed in the diagram?
- Try one more even number and one more odd number.
Investigate
Compare this program with its flow diagram. Explain how each Python statement is represented visually.
username = input("Username: ")
characters = len(username)
if characters >= 5:
print("Accepted")
else:
print("Too short")- Which shape represents the call to
input()? - Why is
characters = len(username)a process rather than a decision? - Which Python expression appears inside the decision diamond?
- What do the True and False labels tell you?
- How are the two
print()statements represented?
The standard symbols
Use the symbol that matches the purpose of each step. A reader should be able to recognise the type of operation from the shape alone.
| Symbol | Name | Use |
|---|---|---|
| Line | Connects one step to the next. Arrowheads can make the direction explicit. | |
| Input / Output | Receives data into the algorithm or sends data out. | |
| Process | Performs an action such as an assignment or calculation. | |
| Decision | Tests a condition and provides two possible paths, normally labelled True/False or Yes/No. | |
| Subprogram | Calls a named subprogram whose detailed steps are defined elsewhere. | |
| Terminal | Marks the Start or End of the algorithm. |
Sequence, selection and iteration
There is no separate “loop” symbol. Iteration is created by connecting a path back to an earlier decision. The three examples below show the main patterns.
From a flow diagram to Python
| Flow diagram idea | Typical Python equivalent |
|---|---|
| Input | input(), often followed by casting |
| Output | print() |
| Process | An assignment or calculation, for example total = price * quantity |
| Decision | A Boolean condition used by selection or iteration |
| Subprogram | A call to a named procedure-style subprogram or function |
| Loop | A path that returns to a decision while repetition is still required |
Checking a flow diagram
- Start and End use terminal shapes.
- Inputs and outputs use parallelograms.
- Assignments and calculations use process rectangles.
- Conditions use decision diamonds.
- Both decision paths are labelled clearly.
- Every shape is connected into the algorithm and every possible route leads onwards.
- Loops return to the correct decision instead of creating an unconnected path.
Self-study guide
A flow diagram represents an algorithm visually. The meaning comes from using the correct standard symbols and connecting them in the correct order. It should show what the algorithm does without depending on Python syntax.
OCR expects the standard symbols for Line, Input/Output, Process, Decision, Sub program and Terminal. A decision creates alternative paths; iteration is shown by a path that returns to an earlier decision rather than by a special “loop” symbol.
OCR Exam Reference Language ↔ Python
| OCR Exam Reference Language / term | Python | What to remember |
|---|---|---|
Terminal | Start / End | Use a terminal symbol for the beginning and end of the algorithm. |
Input / Output | input() / print() | Keyboard input and displayed output. |
Process | assignment / calculation | For example total = price * quantity. |
Decision | if / elif / else or loop condition | A Boolean question creates branches. |
Sub program | function/procedure call | Represents a call to a named subprogram. |
Line | flow of execution | Arrowed connections show the order and direction. |
Worked example
The following Python selection corresponds to a Start → Input → Decision → Output → End flow.
age = int(input("Age: "))
if age >= 13:
print("Allowed")
else:
print("Not allowed")Allowed
- Start with a Terminal symbol.
input()is represented by an Input/Output symbol.age >= 13?belongs in a Decision symbol.- The two branches should be clearly labelled, for example Yes/No or True/False.
- Each output uses an Input/Output symbol.
- The paths can rejoin before the final End terminal.
Another example
Iteration uses the same decision symbol, but one path returns to repeat part of the algorithm.
count = 1
while count <= 3:
print(count)
count = count + 11 2 3
- The decision asks
count <= 3?. - The True/Yes branch performs the output and update.
- The flow then returns to the decision.
- The False/No branch leaves the loop and continues to End.
Common mistakes
- Inventing a special loop symbol instead of using a decision plus a return path.
- Using a Process symbol for input or output.
- Leaving decision branches unlabelled so the routes are ambiguous.
- Forgetting the Sub program symbol when the algorithm calls a procedure or function.
Exam-ready checklist
- Choose the correct symbol for each action.
- Construct sequence, selection and iteration using flow-diagram conventions.
- Translate a flow diagram into code and code into a flow diagram.
- Use a Sub program symbol for a subprogram call.
- Label decision branches clearly.
What you have learned
- Flow diagrams use standard shapes to represent different kinds of algorithm step.
- A decision has two clearly labelled paths.
- Sequence, selection and iteration can all be represented visually.
- The same algorithm can be expressed as a flow diagram or as program code.