Free example lesson
Year 7 · Python · Free lesson

Make Python talk

Write your first Python output, make the computer calculate, and become a bug detective.

50–60 minutesBeginner friendlyNo student login needed
0

Get ready: choose your Python

5–10 mins

Your teacher will tell you which option to use. For this introductory lesson, the built-in editor is the quickest choice: it runs Python inside your browser and does not save or send your code to this website.

Option 2 · Open Thonny

Search for Thonny on the school computer. Select File → New, type your code and press the green Run button.

Official Thonny website ↗
Option 3 · Install Python

For home use, ask an adult or IT administrator before installing software.

Official Python downloads ↗
Teacher check: make sure every pupil can type, run and see output before continuing. The first run of the built-in editor may take a few seconds on a school network.
1

Start: think like a computer

Predict before you run it:
print("Hello!")
print(4 + 5)
print("4 + 5")

Which line displays a greeting? Which calculates an answer? Why does the final line behave differently?

Reveal the explanation

Quotation marks tell Python that something is text—a string. Without quotation marks, 4 + 5 is treated as a calculation.

Your first Python Lab task: select Load example, select Run Python and inspect the output. Then select Clear so the editor is ready for your own code.

Task 1: learn how to use the Python Lab

main.py
Output
Your output will appear here.

Your code stays in this browser tab. The first run may take a few seconds while Python loads.

2

What you will learn

UnderstandExplain what output is.
ApplyUse print() for text and calculations.
DebugFind and correct simple syntax errors.
3

Learn: output with print()

Output is information a computer sends out. In Python, the built-in print() function displays output on the screen.

print("Hello, world!")
print("I am learning Python.")
Remember: text needs matching quotation marks, and the instruction must end with a closing bracket.

Try it

  1. Run the example.
  2. Change the greeting.
  3. Add a third line introducing yourself.

Python Lab: practise output

main.py
Output
Your output will appear here.

Your code stays in this browser tab. The first run may take a few seconds while Python loads.

4

Try: make Python calculate

Python can calculate inside a print statement. Combine an explanation with the result by separating items with commas.

print("35 + 26 =", 35 + 26)
print("23 - 7 =", 23 - 7)
print("7 × 21 =", 7 * 21)
print("155 ÷ 5 =", 155 / 5)
SupportChange the numbers but keep the structure.
CoreWrite four new calculation questions.
StretchPrint a sentence containing two calculations.

Python Lab: calculations

main.py
Output
Your output will appear here.

Your code stays in this browser tab. The first run may take a few seconds while Python loads.

5

Debug: become a bug detective

Programs must follow Python’s syntax rules. Each line below contains one mistake. Correct all four.

print("Welcome to Python)Print("Can you fix me?")print(There is a bug here)prnt("Nearly finished!")
Reveal the corrected code
print("Welcome to Python")
print("Can you fix me?")
print("There is a bug here")
print("Nearly finished!")
Explain, don’t just repair: identify the missing quotation mark, incorrect capital letter, missing quotation marks and misspelled function name.

Python Lab: fix the bugs

main.py
Output
Your output will appear here.

Your code stays in this browser tab. The first run may take a few seconds while Python loads.

6

Challenge: create something worth sharing

Create a short program called About Me. It should be suitable to show your class but must not contain private information.

Extension: make the output form a simple picture, pattern or joke.

Python Lab: create your program

main.py
Output
Your output will appear here.

Your code stays in this browser tab. The first run may take a few seconds while Python loads.

7

Review: exit ticket

8

Create my lesson record

Your record gathers your Python programs, their latest output, your quiz result and your written reflection into one document.

Important: your work is saved temporarily in this browser on this computer only. It will not follow you to another computer. Create and save your lesson record before leaving this page or changing computer.

Want the complete resource library?

LearnITwithMrC membership will include complete KS3 and GCSE Computing lessons, activities and revision materials.

Join the membership launch list