← Years 7–8 Creating Digital Solutions

Running a Python program

A text file of Python instructions. You write it in the editor, and when you press Run, Python does each line in order from first to last and shows the output in the output panel.

Understanding Running a Python program in Years 7–8 Creating Digital Solutions

What it does: The output panel shows 1, then 2, then 3, because the lines run in the order they are written. The print line is typed in the editor. After pressing Run, Go! appears in the output panel. A program is a text file of Python instructions. Python reads it and does what it says. Pressing Run tells Python to start working through your program. Python starts at the top and goes down one line at a time, in order. Line 1 runs first, so A appears first. Then line 2 runs and B appears.

Common mistakes: Python cares about capital letters. The variable was made as name (lowercase), so Name causes an error when you press Run. It should be print("Hi", name). print is spelled wrong. Python runs line 1 first and stops with an error because it does not know prnt. It should be print("Welcome").

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
What is a Python program?
A picture that Python draws on screenA text file of instructions that Python runs
Matches
print("Hi") print("Bye") # expected output: Bye then Hi
↓
Python does not run the last line first. It runs from the first line to the last, so Hi shows before Bye.
Applying
Meanings
Term
program
Meaning
A text file of Python instructions. You write it in the editor, and when you press Run, Python does each line in order from first to last and shows the output in the output panel.
Practice
print("Program starting")
Testing
Gaps
("Hello, world!")
Check Answer
Spots
2name = "Sam"
3print("Hi", Name)

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

The 'Ostrich' badge — Full Sprint, 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. What is a Python program?
A. A picture that Python draws on screen
B. A text file of instructions that Python runs ✓
A program is a text file of Python instructions. Python reads it and does what it says.
2. Where do you write your Python instructions?
A. In the editor ✓
B. In the output panel
You type your code in the editor. The output panel only shows the results.
3. Where do you see the words printed by print("Hi")?
A. In the output panel ✓
B. In the editor
When the program runs, the output panel shows what print() produces.
4. Which button makes Python start doing your instructions?
A. Save as
B. Run ✓
Pressing Run tells Python to start working through your program.
5. In which order does Python run the lines of a program?
A. From the first line to the last line ✓
B. From the last line to the first line
Python starts at the top and goes down one line at a time, in order.

Match the Pairs

print("Hi") print("Bye") → Python runs the lines in order, so the output panel shows Hi first and then Bye
print("Hello") → A one-line program: when you press Run, the output panel shows Hello
Python runs a program one line at a time, starting at the first line and finishing at the last line → print(1) print(2) print(3)
You write the instructions in the editor, and the results appear in the output panel after you press Run → print("Go!")
print("Hi") print("Bye") # expected output: Bye then Hi → Python does not run the last line first. It runs from the first line to the last, so Hi shows before Bye.
print("Score: 10") # I typed this but did not press Run # output panel is empty → The program was written in the editor but never run. Python only does the instructions after you press Run.

Key Term

program
A text file of Python instructions. You write it in the editor, and when you press Run, Python does each line in order from first to last and shows the output in the output panel.

Fill in the Blanks

1. print("Hello, world!")
Hint: Type the function name that shows text in the output panel.
2. print("Ready") print("Set") print("Go!")
Hint: Type the function name that adds the middle line to the output panel.
3. lives = 3 lives = lives - 1 print(lives)
Hint: Type the variable name whose final value shows after the lines run in order.
4. a = 2 b = a * 3 print(b)
Hint: Type the variable name that holds the result of the multiplication.
5. print(2 + 3)
Hint: Type the arithmetic operator that makes the output panel show 5 when you press Run.

Spot the Error

Question 1
A print("Start")
B name = "Sam"
C print("Hi", Name)
Line C — Python cares about capital letters. The variable was made as name (lowercase), so Name causes an error when you press Run. It should be print("Hi", name).
Question 2
A prnt("Welcome")
B print("Press Run")
C print("Done")
Line A — print is spelled wrong. Python runs line 1 first and stops with an error because it does not know prnt. It should be print("Welcome").
Question 3
A print("Step 1")
B print("Step 2)
C print("Step 3")
Line B — The text is missing its closing quote. Python cannot finish reading the string, so it shows a syntax error. It should be print("Step 2").
Question 4
A score == 10
B score = score + 5
C print(score)
Line A — A double equals sign compares values. It does not store one. Python runs line 1 first, so score is never created. Use a single = like score = 10.
Question 5
A print("Loading...")
B print "Ready!"
C print("Go")
Line B — In Python 3, print needs brackets around what it shows. Without them Python gives a syntax error. It should be print("Ready!").

Student with a class code? Join your class →