Book a free demo

🐍 Python for beginners · session 1 of 57 · 60 minutes

Hello, Python: print, text and comments

Write and run your first programs. One idea at a time: learn it, see it run, practise it until it is easy, then move on. By the end you can print anything, do sums, draw with symbols and fix errors.

🖨 Practice sheet

A complete lesson · 60 minutes

Teach it, see it, practise it, all on this page.

Open this page with your learner and work down it, or press Teach this lesson to go through it one step at a time on a big screen. Every section has something to do.

See the teacher's plan
  1. Warm-up4 min
  2. Programs and print9 min
  3. Text and numbers9 min
  4. Comments and repeating8 min
  5. Fixing errors6 min
  6. Name badge8 min
  7. Shop receipt7 min
  8. Times-table strip5 min
  9. Quiz3 min
  10. Set the project1 min

By the end you can

  • Explain what a program is and that Python runs it from top to bottom
  • Use print() to show text and numbers
  • Tell text (in quotes) apart from numbers and sums
  • Draw with repeated strings and label code with comments
  • Read an error message and fix the line

Before you start

  • Can type on a keyboard
  • No coding needed

Have ready

  • A computer with this page open (nothing to install)
  • A notebook for new words

Beginner · ages 10 and up

Warm-up · think first

You have a robot that does exactly what you say, in order, and nothing else. Write the steps for it to make a glass of lemonade. What goes wrong if you swap two steps or leave one out?

Show the answer

A program is a list of exact instructions that runs in order. If a step is missing ("open the tap") or two are swapped ("stir" before "add sugar"), the robot still follows them exactly, so the result is wrong. Computers are the same: they do what we write, not what we mean.

Teacher tip: Let the learner read their steps aloud while you act as the robot and follow them literally. Then say: today we give instructions to Python.

Part 1 of 4 · learn, see, practise

What is a program?

A program is a list of instructions for a computer. Python reads it from the top line to the bottom line, one line at a time.

print() shows whatever is inside its brackets. Text must go inside quotation marks, like "Hello": the quotes tell Python this is text to show, not an instruction.

Example: run it, then change it

Output

Hello, world!
I am learning Python.

Memory boxes

No variables yet

Press Run. Line 1 runs, then line 2, so you see two lines in the same order. Swap the lines and run again.

Practise it

Start with the warm-up and go as far as you can. The stretch questions are meant to be hard.

Warm-up

1.1 Print exactly: Hello, world!

Task 1.1

Output

(nothing is printed)

Memory boxes

No variables yet
Model answer (for the teacher)
print("Hello, world!")
Warm-up

1.2 Print three lines: your name, your class and your school.

Task 1.2

Output

(nothing is printed)

Memory boxes

No variables yet
Model answer (for the teacher)
print("Asha")
print("Class 5")
print("Green Valley School")
Core

1.3 Print this poem exactly, on two lines:
Roses are red
Python is fun

Task 1.3

Output

(nothing is printed)

Memory boxes

No variables yet
Model answer (for the teacher)
print("Roses are red")
print("Python is fun")
Stretch 🔥

1.4 Print a triangle of stars exactly like this, one print per line:
*
**
***
****

Task 1.4

Output

(nothing is printed)

Memory boxes

No variables yet
Model answer (for the teacher)
print("*")
print("**")
print("***")
print("****")

Part 2 of 4 · learn, see, practise

Text and numbers

Text inside quotes is a string. Numbers need no quotes, and Python can do maths with them: + adds, - subtracts, * multiplies, / divides.

print(7 + 5) shows 12, but print("7 + 5") shows the text 7 + 5, because it is inside quotes.

Commas let you print several things on one line; Python puts a space between them.

Example: run it, then change it

Output

12
7 + 5
My age is 11
Minutes in a day: 1440

Memory boxes

No variables yet

Lines 1 and 2 differ only by the quotes. Line 4 mixes text and a calculation.

Practise it

Start with the warm-up and go as far as you can. The stretch questions are meant to be hard.

Warm-up

2.1 Make Python work out 25 + 17 and print the answer.

Task 2.1

Output

(nothing is printed)

Memory boxes

No variables yet
Model answer (for the teacher)
print(25 + 17)
Core

2.2 Print the sum as text on line 1 and its answer on line 2:
7 + 5
12

Task 2.2

Output

(nothing is printed)

Memory boxes

No variables yet
Model answer (for the teacher)
print("7 + 5")
print(7 + 5)
Core

2.3 Print exactly: Hours in a week: 168, with Python doing the multiplying.

Task 2.3

Output

(nothing is printed)

Memory boxes

No variables yet
Model answer (for the teacher)
print("Hours in a week:", 24 * 7)
Stretch 🔥

2.4 A cinema has 18 rows of 24 seats. Print two lines, worked out by Python:
Seats: 432
Two shows: 864

Task 2.4

Output

(nothing is printed)

Memory boxes

No variables yet
Model answer (for the teacher)
print("Seats:", 18 * 24)
print("Two shows:", 18 * 24 * 2)
Stretch 🔥

2.5 Asha scored 85, 90 and 77 in three tests. Print her average, worked out by Python (it should show 84.0).

Task 2.5

Output

(nothing is printed)

Memory boxes

No variables yet
Model answer (for the teacher)
print((85 + 90 + 77) / 3)

Part 3 of 4 · learn, see, practise

Comments, joining and repeating text

A line starting with # is a comment. Python skips it; it is a note for people.

+ between two strings joins them: "ice" + "cream" is "icecream". * repeats a string: "ha" * 3 is "hahaha". Together they draw borders and boxes.

print() with nothing inside prints an empty line.

Example: run it, then change it

Output

====================
  PYTHON CLUB
====================

+----------+

Memory boxes

No variables yet

The comment prints nothing. Count the characters in the last line: 1 + 10 + 1.

Practise it

Start with the warm-up and go as far as you can. The stretch questions are meant to be hard.

Warm-up

3.1 Print a line of exactly 15 # signs using * (do not type 15 of them).

Task 3.1

Output

(nothing is printed)

Memory boxes

No variables yet
Model answer (for the teacher)
print("#" * 15)
Core

3.2 Print this box exactly, using * for the dashes:
+----------+
| PYTHON |
+----------+

Task 3.2

Output

(nothing is printed)

Memory boxes

No variables yet
Model answer (for the teacher)
print("+" + "-" * 10 + "+")
print("|  PYTHON  |")
print("+" + "-" * 10 + "+")
Core

3.3 Print a staircase of five lines: #, ##, ###, ####, ##### (use * on every line).

Task 3.3

Output

(nothing is printed)

Memory boxes

No variables yet
Model answer (for the teacher)
print("#" * 1)
print("#" * 2)
print("#" * 3)
print("#" * 4)
print("#" * 5)
Stretch 🔥

3.4 Write a program with at least two comment lines that prints a flag:
*****=====
*****=====
*****=====
Use * to build each line from "*" and "=".

Task 3.4

Output

(nothing is printed)

Memory boxes

No variables yet
Model answer (for the teacher)
# my flag
# three equal stripes
print("*" * 5 + "=" * 5)
print("*" * 5 + "=" * 5)
print("*" * 5 + "=" * 5)

Part 4 of 4 · learn, see, practise

Reading an error and fixing it

When Python cannot understand a line it stops and shows an error with a line number.

The usual first errors: a missing quote, a missing bracket, Print with a capital P, or text without quotes. Read the line number, compare with a line that works, change one thing, run again.

Example: run it, then change it

Output

Line 2: SyntaxError: unterminated string literal

Memory boxes

No variables yet

Run it: the message points at line 2. Add the missing quote and run again.

Practise it

Start with the warm-up and go as far as you can. The stretch questions are meant to be hard.

Warm-up

4.1 Fix the program so it prints: Good morning

Task 4.1

Output

Line 1: SyntaxError: unterminated string literal

Memory boxes

No variables yet
Model answer (for the teacher)
print("Good morning")
Core

4.2 Fix both lines so the program prints Hello and then World.

Task 4.2

Output

Line 2: SyntaxError: expected ')'

Memory boxes

No variables yet
Model answer (for the teacher)
print("Hello")
print("World")
Stretch 🔥

4.3 There are three mistakes. Fix them so the output is exactly:
Score: 10
Total: 15
Bye

Task 4.3

Output

Line 1: SyntaxError: expected ')'

Memory boxes

No variables yet
Model answer (for the teacher)
print("Score:", 10)
print("Total:", 5 + 10)
print("Bye")

Watch out

Common mistakes

Print with a capital P

Print("Hi") does not work. Python is case-sensitive.

Forgetting the quotes

print(Hello) makes Python look for something called Hello. Text needs quotes.

Mixing quote types

print("Hi') starts with " and ends with '. Use the same kind at both ends.

Class activity 1 of 3

Name badge

Build a name badge one step at a time. Press Check after each step to see which parts already work.

  1. Print a top border of exactly 30 = signs, using *.
  2. Print NAME: followed by your name on one line.
  3. Print your age, then on the next line your age in months worked out by Python (age × 12).
  4. Print one hobby you love.
  5. Print the bottom border, the same as the top.
Your code

Output

(nothing is printed)

Memory boxes

No variables yet
Hint

Each step is one or two print lines. For the months, write print("Age in months:", 11 * 12) with your own age.

Model answer (for the teacher)
# Step 1
print("=" * 30)
# Step 2
print("NAME: Kabir")
# Step 3
print("Age:", 11)
print("Age in months:", 11 * 12)
# Step 4
print("I love: football")
# Step 5
print("=" * 30)

Class activity 2 of 3

Shop receipt

Print a receipt that looks exactly like the one below. The total must be worked out by Python.
------------------------
SUPER STATIONERY
------------------------
Pencil 12
Notebook 45
Eraser 8
Total 65
Thank you!

  1. Print a line of 24 dashes using *.
  2. Print the shop name, then another line of 24 dashes.
  3. Print each item and its price on its own line (use a comma between them).
  4. Print Total and the sum 12 + 45 + 8, worked out by Python.
  5. Print Thank you! at the end.
Your code

Output

(nothing is printed)

Memory boxes

No variables yet
Hint

print("Pencil", 12) prints Pencil 12 with one space.

Model answer (for the teacher)
print("-" * 24)
print("SUPER STATIONERY")
print("-" * 24)
print("Pencil", 12)
print("Notebook", 45)
print("Eraser", 8)
print("Total", 12 + 45 + 8)
print("Thank you!")

Class activity 3 of 3

Times-table strip

Print the first six lines of the 7 times table, with Python doing every multiplication:
7 x 1 = 7
7 x 2 = 14
… up to 7 x 6 = 42. Then print a line of 20 stars and the line: Total of the answers: 147 (worked out by Python).

  1. Print 7 x 1 = and the answer 7 * 1, using a comma.
  2. Do the same for 2 to 6.
  3. Print a line of 20 stars.
  4. Print Total of the answers: and let Python add 7 + 14 + … + 42 (or 7 * 21).
Your code

Output

7 x 1 = 7

Memory boxes

No variables yet
Hint

Copy the first line five times and change the numbers.

Model answer (for the teacher)
print("7 x 1 =", 7 * 1)
print("7 x 2 =", 7 * 2)
print("7 x 3 =", 7 * 3)
print("7 x 4 =", 7 * 4)
print("7 x 5 =", 7 * 5)
print("7 x 6 =", 7 * 6)
print("*" * 20)
print("Total of the answers:", 7 + 14 + 21 + 28 + 35 + 42)

Quiz · 8 questions

Check what you learned

Pick an answer to see if it is right and why. Your best score is saved on this device.

1What does this show?
print("5 + 3")
Show the answer

5 + 3. Everything inside quotes is shown exactly as written.

2What does this show?
print(5 + 3)
Show the answer

8. Without quotes, Python works out 5 + 3.

3Which line is a comment?
Show the answer

# draw a cat. A comment starts with #. The second one prints the text.

4What does this show?
print("Hi", "there")
Show the answer

Hi there. A comma prints the items with one space between.

5What does this show?
print("ab" + "c" * 3)
Show the answer

abccc. * happens first: "ccc", then + joins it to "ab".

6What does this show?
print(2 * 3 + 1)
Show the answer

7. Multiplication first: 6, then + 1.

7Why does print("Hello) stop with an error?
Show the answer

The closing quote is missing. The text was opened with " but never closed.

8What does this show?
print("-" * 3 + ">")
Show the answer

--->. Three dashes, then the arrow head is joined on.

After class · project

My poster

Make a poster about you or a hobby, drawn with print(). Use the starter code: it already has the sections. Fill each one in.

What to make: A program of at least 12 lines that prints your poster with no errors.

Stretch: Make a border out of two symbols, like "=-" * 13, and a drawing at least 6 lines tall.

How it is marked

Look forDone well when
RunsNo errors when you press Run
SectionsTitle, facts, calculation and drawing are all there
CommentsEach section has a comment
CreativeThe poster says something about you

Starter code to take home

Press Copy and paste it into the editor at home, or work on it right here.

Project starter

Output

==========================
    ALL ABOUT ME
==========================
Name: your name here
My age in days is about 4015
   (o.o)   
   / | |   

Memory boxes

No variables yet

Homework

Practise at home

Each one checks itself. Or print the practice sheet.

Warm-up

1. Print a three-line address label: your name, your city and your country.

Homework 1

Output

(nothing is printed)

Memory boxes

No variables yet
Core

2. Print the number of seconds in one day, worked out by Python, with the label Seconds in a day:

Homework 2

Output

(nothing is printed)

Memory boxes

No variables yet
Stretch 🔥

3. Print a hollow square 5 wide, using * and +:
*****
* *
* *
*****

Homework 3

Output

(nothing is printed)

Memory boxes

No variables yet

For parents and teachers

The 60-minute lesson plan

Use it as it is, or stretch any part over two sessions. Each row links to the part of the page you need.

TimePartThe teacherThe learner
0–4 minWarm-upAct as the literal robot for the lemonade steps.Write steps; spot the bugs.
4–13 minPrograms and printRun the example, then let them do the four practice tasks.Practise up to the star triangle.
13–22 minText and numbersAsk why lines 1 and 2 differ, then practice.Do the cinema and average tasks.
22–30 minComments and repeatingCount characters in the box together.Draw the box and the flag.
30–36 minFixing errorsRead the error message aloud together.Fix all three broken programs.
36–44 minName badgeLet them follow the steps alone.Build the badge and press Check.
44–51 minShop receiptPoint out the exact output.Match the receipt exactly.
51–56 minTimes-table stripIf time is short, set it as homework.Build the strip.
56–59 minQuizRun the quiz.Answer and read why.
59–60 minSet the projectOpen the starter and agree a due date.Copy the starter.

Questions to ask

  • What is the difference between print(5 + 3) and print("5 + 3")?
  • What does + do between two strings? And *?
  • When you see an error, what do you look at first?

If it feels hard

Type the examples together line by line before the practice. Do only levels 1 and 2 in class and set level 3 as homework.

If it feels easy

Ask for a 6-line drawing of a house where every line uses * to repeat a symbol.

FAQ

Hello, Python: print, text and comments: questions

Do we need to install Python for this lesson?

No. Every example, practice task and activity runs on this page in the browser.

What age can start with this Python course?

Learners from about 9 or 10 can follow it with a teacher; older learners and adults can work through it alone.

How is each session organised?

In loops: a short explanation, a runnable example, practice at three levels, then the next idea. Three bigger activities, a quiz and an after-class project end the class.

Start a conversation

Want a teacher to take this class?

Tell us the learner's age and level. A teacher from our network teaches with these lessons; we confirm timing and price first.

  • Tell us the learner’s age or grade and goals
  • We’ll suggest a suitable class or learning path
  • We’ll confirm format, timing and fees with a parent or guardian

For a child’s class, please have a parent or guardian send the enquiry. Avoid sharing passwords or sensitive personal details.

We’ll use your details only to respond to this request.

Chat on WhatsApp
Esc

Try