← Years 7–8 Creating Digital Solutions

Turning a flowchart into Python

A flowchart diamond (a decision) becomes if, or while when an arrow loops back to it. Rectangles become statements and parallelograms become input() or print().

Understanding Turning a flowchart into Python in Years 7–8 Creating Digital Solutions

What it does: Parallelograms show input or output. An input parallelogram is coded with input() and stored in a variable. Rectangles are process steps, so each one becomes a normal Python statement such as an assignment. A diamond with Yes and No paths that move forward is a one-off decision, so it becomes an if statement. An arrow looping back to the diamond means the check is repeated, so we use while. A parallelogram for input becomes input(). The second option just stores text and never asks the user anything. A decision with no loop back is coded as if x > 10:. Using while would repeat the print and could run forever.

Common mistakes: The decision diamond becomes an if statement, and every if line must end with a colon. It should be: if age >= 13:. The rectangle that adds 1 must be a statement that stores the answer. 'count + 1' works it out but does not save it, so count never changes and the loop never ends. It should be: count = count + 1.

Class: _____________________  ·  Name: _____________________  ·  Date: _________

Free printable worksheet with full answer key — or add this module to a class and your students practise it interactively.

This module's key terms are also in a printable crossword (Modules 50–125) and word search (Modules 3–125).

Take this worksheet further — free with Cloodit

Each concept is reinforced from every angle — learned, then applied, then tested.

Learning
Duo
A flowchart has a diamond that asks 'Is age >= 13?' with a Yes path and a No path, and no arrows going back. Which Python keyword does the diamond become?
ifwhile
Matches
if count < 5: count = count + 1 (flowchart has a back arrow to the diamond)
↓
The flowchart has an arrow looping back to the diamond, so it needs a while loop, not an if. An if only checks once.
Applying
Meanings
Term
if / while
Meaning
A flowchart diamond (a decision) becomes if, or while when an arrow loops back to it. Rectangles become statements and parallelograms become input() or print().
Practice
score = 7
Testing
Gaps
age >= 13:
Check Answer
Spots
1age = int(input('Age: '))
2if age >= 13

Cloodit turns curriculum-aligned coding content into journeys students work through one biome at a time.

The 'Pufferfish' badge — Error Handler, one of Cloodit's 106 collectible badges
Students earn collectable badges

Over 100 of them, across seven natural biomes.

Study Buddy
Students build a real study resource

Turns their work into revision material ready for Flash Cards and Exam study.

Diamond Dash — one of Cloodit's live, competitive Sprint games
Students lock in with Sprints

Live, competitive practice for the start of the lesson or a teacher-led lesson finisher.

A Cloodit certificate of achievement, ready to personalise and print
Custom printable certificates

Honour your top performers, or encourage a student who's trying hard — ready to print in seconds.

Quick Questions

1. A flowchart has a diamond that asks 'Is age >= 13?' with a Yes path and a No path, and no arrows going back. Which Python keyword does the diamond become?
A. if ✓
B. while
A diamond with Yes and No paths that move forward is a one-off decision, so it becomes an if statement.
2. A flowchart has a diamond 'Is count < 5?'. The Yes path goes to a rectangle, then an arrow loops back up to the diamond. Which keyword does it become?
A. while ✓
B. if
An arrow looping back to the diamond means the check is repeated, so we use while.
3. A flowchart has a parallelogram that says 'Get name from user'. Which Python code matches it?
A. name = 'Name? '
B. name = input('Name? ') ✓
A parallelogram for input becomes input(). The second option just stores text and never asks the user anything.
4. A flowchart has a parallelogram that says 'Show score'. Which Python code matches it?
A. print(score) ✓
B. score = input()
A parallelogram for output becomes print(). input() is used when the flowchart gets data from the user.
5. A flowchart has a rectangle that says 'total = total + 5'. What does it become in Python?
A. if total + 5:
B. total = total + 5 ✓
A rectangle is a process step, so it becomes a normal statement. Only diamonds turn into if or while.

Match the Pairs

if age >= 13: → A diamond asking a question like 'Is age 13 or more?' where the flow only goes forward
while lives > 0: → A diamond asking 'Is lives more than 0?' where an arrow loops back to it from the Yes path
A parallelogram that says 'Input name' becomes an input() call → name = input('Name? ')
A rectangle that says 'Add 1 to score' becomes a statement → score = score + 1
if count < 5: count = count + 1 (flowchart has a back arrow to the diamond) → The flowchart has an arrow looping back to the diamond, so it needs a while loop, not an if. An if only checks once.
while x > 10: print('Big') (flowchart diamond has no back arrow) → The diamond has no arrow looping back, so it is a one-time decision. It should be an if, not a while.

Key Term

if / while
A flowchart diamond (a decision) becomes if, or while when an arrow loops back to it. Rectangles become statements and parallelograms become input() or print().

Fill in the Blanks

1. if age >= 13: print("Teen")
Hint: Type the keyword for a diamond decision with no arrow looping back to it.
2. while count < 5: count = count + 1
Hint: Type the keyword used when an arrow loops back to the diamond.
3. name = input("Name? ") print(name)
Hint: Type the function that a parallelogram uses to get data from the user.
4. score = 10 print(score)
Hint: Type the function that a parallelogram uses to show output on the screen.
5. while lives > 0: print("Playing") lives = lives - 1
Hint: Type the operator for the rectangle step that takes one away from lives.

Spot the Error

Question 1
A age = int(input('Age: '))
B if age >= 13
C print('Teen')
Line B — The decision diamond becomes an if statement, and every if line must end with a colon. It should be: if age >= 13:
Question 2
A count = 1
B while count <= 3:
C print(count)
D count + 1
Line D — The rectangle that adds 1 must be a statement that stores the answer. 'count + 1' works it out but does not save it, so count never changes and the loop never ends. It should be: count = count + 1
Question 3
A score = int(input('Score: '))
B while score > 50:
C print('Pass')
Line B — This diamond has no arrow looping back to it, so it is a single decision. It should be: if score > 50:, not a while loop.
Question 4
A num = input('Number: ')
B num = int(num)
C input(num * 2)
Line C — A parallelogram that shows a result becomes print(). input() is only for getting a value from the user. It should be: print(num * 2)
Question 5
A pin = print('PIN: ')
B if pin == '1234':
C print('Open')
D else:
E print('Locked')
Line A — A parallelogram that asks the user for a value becomes input(). It should be: pin = input('PIN: ')

Student with a class code? Join your class →