🐍 Python for beginners · session 3 of 58 · 60 minutes · free

Practice class: print and variables (homework pack)

A practice class for Grade 6. No new big ideas: just print() and variables, used again and again until they feel easy. Play the warm-up games, fill in the boilerplate code step by step, then take the homework pack home. Every task checks itself.

🎯 Practice mode🖨 Print a worksheet

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-up3 min
  2. Warm-up games5 min
  3. Print warm-up6 min
  4. Variables7 min
  5. Text and f-strings7 min
  6. Tracing and swaps6 min
  7. Game character card7 min
  8. Cricket scoreboard7 min
  9. Recipe scaler5 min
  10. Quiz5 min
  11. Set the after-class activity2 min

By the end you can

  • Print text, numbers and patterns exactly, using commas, sep and end
  • Make, use and change variables with = and +=
  • Build sentences from variables with f-strings
  • Trace a program line by line and swap two variables
  • Fill in a boilerplate program step by step and test it

Before you start

  • Session 1: print(), text and comments
  • Session 2: variables (helpful, but each idea is recapped here)

Have ready

  • This page (nothing to install)
  • A notebook for the trace tables

Beginner · ages 10 and up

Warm-up · think first

Mystery boxes! a = 5, then b = a, then a = 9. What is inside b now: 5 or 9?

Show the answer

5. When b = a runs, b gets a copy of the 5 inside a. Changing a afterwards puts a new value in a's box only; b keeps its own 5.

Teacher tip: Take a vote first. Then draw two boxes, a and b, and update them line by line. Most learners say 9.

More warm-ups for every class →

🎮 Warm-up games · 6 quick games

Play with Bolt the robot

Five minutes, six quick games. Pick an answer, then press Show the answer. Spin the wheel for a random one.

  1. Which one doesn't belong? (print("hi") · Print("hi") · print('hi') · print("h" + "i"))
    Answer: Print("hi") is the odd one: the capital P makes an error. Every other line prints hi. (print('hi') is the only one with single quotes, and that is fine too.)
  2. Would you rather start with coins = 50 and then coins += 25, or coins = 100 and then coins -= 30? (coins = 50, then coins += 25 · coins = 100, then coins -= 30)
    Answer: A: 50 + 25 = 75 coins beats 100 − 30 = 70 coins.
  3. print(a + b) shows a number. (Always · Sometimes · Never)
    Answer: Sometimes. If a = 2 and b = 3 it shows 5. If a = "2" and b = "3" it joins the text and shows 23, which is text, not a number!
  4. How many characters does print("ha" * 12) show? Make a smart guess.
    Answer: 24 characters: "ha" has 2 letters and it is repeated 12 times.
  5. How many different ways can you make Python print 12?
    Answer: Lots! print(12), print(6 * 2), print(3 + 9), print("12"), print("1" + "2"), x = 12 then print(x), print(f"{12}") …
  6. x = 3, then x = x * x, then x = x + x. What is in x at the end?
    Answer: 18. x becomes 3 × 3 = 9, then 9 + 9 = 18.

Part 1 of 4 · learn, see, practise

Print warm-up: lines, commas, sep and end

print() shows what is inside its brackets and then moves to a new line. Text goes in quotes; numbers and sums do not.

A comma prints several things with a space between them. sep= changes that space: print(1, 2, 3, sep="-") shows 1-2-3.

end= changes what comes after the line. print("Wait", end="") stays on the same line, so the next print carries on from there.

Example: run it, then change it

▶ Output

Hi there
5/11/2026
Loading...
============

📦 Memory boxes

No variables yet

Line 2 joins the numbers with / instead of spaces. Lines 3 and 4 make one line together, because of end="".

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: Python is fun!

Task 1.1

▶ Output

(nothing is printed)

📦 Memory boxes

No variables yet
Model answer (for the teacher)
print("Python is fun!")
Warm-up

1.2 Print a line of 12 = signs, then GAME OVER, then 12 = signs again. Use * for the repeats.

Task 1.2

▶ Output

(nothing is printed)

📦 Memory boxes

No variables yet
Model answer (for the teacher)
print("=" * 12)
print("GAME OVER")
print("=" * 12)
Core

1.3 Print the time 12:30:45 using print(12, 30, 45, …) and sep.

Task 1.3

▶ Output

(nothing is printed)

📦 Memory boxes

No variables yet
Model answer (for the teacher)
print(12, 30, 45, sep=":")
Stretch 🔥

1.4 Use four print() calls and end= to print one single line: 3... 2... 1... Go!

Task 1.4

▶ Output

(nothing is printed)

📦 Memory boxes

No variables yet
Model answer (for the teacher)
print("3...", end=" ")
print("2...", end=" ")
print("1...", end=" ")
print("Go!")

Part 2 of 4 · learn, see, practise

Variables: make them, use them, change them

A variable is a named box that holds a value: lives = 3. The = means "put the value on the right into the box on the left".

To change a box using its old value: lives = lives + 1, or the shortcut lives += 1. Also -= and *=.

A good program uses its variables everywhere, so changing one value at the top changes every answer below it.

Example: run it, then change it

▶ Output

Coins: 10
Coins now: 30

📦 Memory boxes

coins30int

Watch the memory box: coins goes 10 → 15 → 30. Change the first line to 100 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

2.1 The variable player is ready. Print Player: and the player's name, using the variable.

Task 2.1

▶ Output

(nothing is printed)

📦 Memory boxes

player'Aarav'str
Model answer (for the teacher)
player = "Aarav"
print("Player:", player)
Warm-up

2.2 Make a variable called lives that holds 3, then print it.

Task 2.2

▶ Output

(nothing is printed)

📦 Memory boxes

No variables yet
Model answer (for the teacher)
lives = 3
print(lives)
Core

2.3 You lose one life, then win two. Change lives with -= and += and print it.

Task 2.3

▶ Output

(nothing is printed)

📦 Memory boxes

lives3int
Model answer (for the teacher)
lives = 3
lives -= 1
lives += 2
print(lives)
Stretch 🔥

2.4 c holds a temperature in °C. Make f = c * 9 / 5 + 32 and print it like this: 30 C is 86.0 F

Task 2.4

▶ Output

(nothing is printed)

📦 Memory boxes

c30int
Model answer (for the teacher)
c = 30
f = c * 9 / 5 + 32
print(c, "C is", f, "F")

Part 3 of 4 · learn, see, practise

Text in variables and f-strings

Variables can hold text too: city = "Pune". + joins two pieces of text with no space, so add " " yourself.

An f-string fills in variables for you: f"I live in {city}." Put f before the quote and the variable in curly brackets.

len(word) counts the characters in a text; word.upper() gives it in CAPITALS.

Example: run it, then change it

▶ Output

Sara Khan
Sara Khan has 9 characters.
SARA KHAN

📦 Memory boxes

first'Sara'strlast'Khan'strfull'Sara Khan'str

The space between the names counts as a character too: 9 in all.

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 I live in Durgapur. with an f-string and the variable city.

Task 3.1

▶ Output

(nothing is printed)

📦 Memory boxes

city'Durgapur'str
Model answer (for the teacher)
city = "Durgapur"
print(f"I live in {city}.")
Core

3.2 Print the name surname first, like a register: Sen, Riya

Task 3.2

▶ Output

(nothing is printed)

📦 Memory boxes

first'Riya'strlast'Sen'str
Model answer (for the teacher)
first = "Riya"
last = "Sen"
print(f"{last}, {first}")
Stretch 🔥

3.3 Print two lines: python has 6 letters. and then the word in capitals. It must work for any word.

Task 3.3

▶ Output

(nothing is printed)

📦 Memory boxes

word'python'str
Model answer (for the teacher)
word = "python"
print(f"{word} has {len(word)} letters.")
print(word.upper())

Part 4 of 4 · learn, see, practise

Trace it: updates, swaps and memory boxes

To trace a program, go one line at a time and write the value in every box. Only the newest value counts.

To swap two variables you need a spare box (temp = a, a = b, b = temp), or Python's shortcut: a, b = b, a.

Example: run it, then change it

▶ Output

9 4
Total: 14

📦 Memory boxes

a9intb4inttotal14int

After line 3, a holds 9 and b holds 4. Check the memory boxes.

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 Trace the program on paper first, then add a line that prints x.

Task 4.1

▶ Output

(nothing is printed)

📦 Memory boxes

x20int
Model answer (for the teacher)
x = 2
x = x + 3
x = x * 4
print(x)
Core

4.2 Swap left and right, then print left and right on one line (it should show dog cat).

Task 4.2

▶ Output

cat dog

📦 Memory boxes

left'cat'strright'dog'str
Model answer (for the teacher)
left = "cat"
right = "dog"
left, right = right, left
print(left, right)
Stretch 🔥

4.3 Rotate three boxes: a takes b's value, b takes c's and c takes a's old value. Print a, b, c on one line (2 3 1).

Task 4.3

▶ Output

1 2 3

📦 Memory boxes

a1intb2intc3int
Model answer (for the teacher)
a = 1
b = 2
c = 3
a, b, c = b, c, a
print(a, b, c)

Watch out

Common mistakes

Quotes around a variable

print("name") prints the word name. print(name) prints what is inside the box.

Joining text and a number with +

"Age: " + 12 stops with an error. Use a comma, an f-string, or str(12).

Forgetting the f

"Hi {name}" prints the curly brackets. f"Hi {name}" fills them in.

Using a box before making it

print(score) before score = 0 stops with a NameError: make the box first.

Class activity 1 of 3

Game character card

Finish the boilerplate so it prints this card, then levels the hero up:
=========================
HERO: Zara
Level: 3
Health: ♥♥♥♥♥
Coins: 120
=========================
Level up! Zara is now level 4 with 170 coins.

  1. Print the top border: 25 = signs, using *.
  2. Print HERO:, Level: and Coins: lines from the variables (f-strings are easiest).
  3. Print Health: followed by one ♥ for each point of hp, using "♥" * hp.
  4. Print the bottom border.
  5. Level up: add 1 to level and 50 to coins with +=, then print the level-up line.
Your code

▶ Output

HERO: Zara

📦 Memory boxes

name'Zara'strlevel3inthp5intcoins120int
Hint

print("Health: " + "♥" * hp) joins the label and the hearts. For the last line: f"Level up! {name} is now level {level} with {coins} coins."

Model answer (for the teacher)
name = "Zara"
level = 3
hp = 5
coins = 120
print("=" * 25)
print(f"HERO: {name}")
print(f"Level: {level}")
print("Health: " + "♥" * hp)
print(f"Coins: {coins}")
print("=" * 25)
level += 1
coins += 50
print(f"Level up! {name} is now level {level} with {coins} coins.")

Class activity 2 of 3

Cricket scoreboard

Run a two-over match with variables. Over 1: a four, a six and a single. Over 2: a two and a wicket. Then print:
India: 13/1 in 2 overs
Run rate: 6.5

  1. Over 1: add 4, 6 and 1 to runs with +=, and add 6 to balls.
  2. Over 2: add 2 to runs, 1 to wickets and 6 to balls.
  3. Work out overs = balls // 6.
  4. Print the score line with an f-string.
  5. Print the run rate: runs / overs.
Your code

▶ Output

(nothing is printed)

📦 Memory boxes

team'India'strruns4intwickets0intballs0int
Hint

Each ball event is one line, like runs += 6. The score line is f"{team}: {runs}/{wickets} in {overs} overs".

Model answer (for the teacher)
team = "India"
runs = 0
wickets = 0
balls = 0
runs += 4
runs += 6
runs += 1
balls += 6
runs += 2
wickets += 1
balls += 6
overs = balls // 6
print(f"{team}: {runs}/{wickets} in {overs} overs")
print(f"Run rate: {runs / overs}")

Class activity 3 of 3

Recipe scaler

One person needs 100 g of rice and 200 ml of water, and every 2 people need 1 spoon of salt. Fill in the boilerplate so it works for any number of people. For 4 people:
Cooking for 4 people
Rice: 400 g
Water: 800 ml
Salt: 2 spoons

  1. Work out rice = rice_each * people and water = water_each * people.
  2. Work out salt = people // 2.
  3. Print the four lines with f-strings.
  4. Change people to 6 and check: 600 g, 1200 ml, 3 spoons.
Your code

▶ Output

Cooking for 4 people

📦 Memory boxes

people4intrice_each100intwater_each200intrice0int
Hint

rice = rice_each * people. salt = people // 2 gives whole spoons.

Model answer (for the teacher)
people = 4
rice_each = 100
water_each = 200
rice = rice_each * people
water = water_each * people
salt = people // 2
print(f"Cooking for {people} people")
print(f"Rice: {rice} g")
print(f"Water: {water} ml")
print(f"Salt: {salt} spoons")

After class · project

My pocket money tracker (after-class activity)

Finish this boilerplate at home. It tracks your money for one week and prints a neat report. Every TODO is one or two lines. Run it after each step!

What to make: A program with no errors that prints a report of at least 8 lines, all worked out from the variables.

Stretch: Add a variable weeks = 4 and print how much you would save in 4 weeks if every week were the same.

How it is marked

Look forDone well when
RunsNo errors when you press Run
VariablesEvery number in the report comes from a variable
f-stringsThe report lines use f-strings
TestChange one number at the top and the report still adds up

Starter code to take home

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

Project starter

▶ Output

==============================
  Your name's money report
==============================
Started with: Rs 200

📦 Memory boxes

name'Your name'strstart_money200intbirthday_gift100intsnacks45intbooks60intmoney300intgoal500int

Homework

Practise at home

Each one checks itself. Or print the practice sheet.

Warm-up

1. Hello card. Put your name in the box, then print two lines: Name: … and Grade: 6, using the variables.

Homework 1

▶ Output

(nothing is printed)

📦 Memory boxes

name'Aisha'strgrade6int
Warm-up

2. Star strip. Print a line of size stars, then the sentence That was 7 stars (using size both times).

Homework 2

▶ Output

(nothing is printed)

📦 Memory boxes

size7int
Core

3. Pizza party. Print Total slices: …, Each friend gets: … (whole slices) and Left over: ….

Homework 3

▶ Output

(nothing is printed)

📦 Memory boxes

pizzas3intslices_each8intfriends5int
Core

4. Cycle ride. A cyclist rides distance km in time hours. Print Speed: 12.0 km/h (speed = distance / time).

Homework 4

▶ Output

(nothing is printed)

📦 Memory boxes

distance36inttime3int
Stretch 🔥

5. Shelf shuffle. Move the books: top gets bottom's book, middle gets top's old book and bottom gets middle's old book. Then print the three shelves.

Homework 5

▶ Output

Top: maths
Middle: science
Bottom: english

📦 Memory boxes

top'maths'strmiddle'science'strbottom'english'str
Stretch 🔥

6. Digital clock. total holds seconds. Print it as hours:minutes:seconds, like 1:06:40. Hint: f"{m:02d}" shows 6 as 06.

Homework 6

▶ Output

(nothing is printed)

📦 Memory boxes

total4000int

🔥 Challenge round · finished early?

The hardest questions of the lesson, no notes

Cover the notes and try these from memory. They are meant to make you think hard: draw, try small cases, and check your answer.

🧠 Think-hard question

Make a variable n = 4729 and print its digits backwards (9274) using only // and %, so it works for any 4-digit number.

Talk it through or use the drawing board. There is more than one way to get there.

Quiz · 10 questions

Final quiz: 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?
x = 5
x = x + 2
print(x)
Show the answer

7. x takes its old value 5, adds 2 and stores 7.

2What does this show?
name = "Ali"
print("name")
Show the answer

name. With quotes it is just the word name, not the variable.

3What does this show?
a = "3"
b = "4"
print(a + b)
Show the answer

34. "3" and "4" are text, so + joins them.

4What does this show?
print("Hi", "Ravi", sep="-")
Show the answer

Hi-Ravi. sep="-" puts a dash between the items instead of a space.

5What does this show?
a = 2
b = a
a = 10
print(b)
Show the answer

2. b got a copy of 2. Changing a later does not change b.

6What does this show?
score = 10
score += 5
score *= 2
print(score)
Show the answer

30. 10 → 15 → 30.

7What does this show?
x, y = 3, 8
x, y = y, x
print(x, y)
Show the answer

8 3. The second line swaps the two boxes.

8What does this show?
word = "code"
print(f"{word} has {len(word)} letters")
Show the answer

code has 4 letters. The f fills in each pair of curly brackets.

9Which is a correct variable name?
Show the answer

score_2. Names cannot start with a number or contain spaces or dashes. score_2 is fine.

10What does this show?
print("ab" * 2, end="!")
Show the answer

abab!. "ab" * 2 is abab, and end="!" ends the line with ! instead of a new line.

🖨 Print what we learned

Make a worksheet from this lesson

Pick what to practise, then print it or choose Save as PDF in the print window to download it.

Include
Options

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–3 minWarm-upVote on the mystery boxes before revealing.Guess, then trace.
3–8 minWarm-up gamesPlay three or four games; spin the wheel for the last one.Pick, explain, reveal.
8–14 minPrint warm-upRun the example, then race through the tasks.Do tasks up to the countdown.
14–21 minVariablesChange the first line of the example and re-run.Do the temperature task.
21–28 minText and f-stringsCount the characters in the full name together.Finish the capitals task.
28–34 minTracing and swapsDraw the trace table on the drawing board.Swap and rotate.
34–41 minGame character cardShow the boilerplate and the TODOs; let them press Check often.Build the card.
41–48 minCricket scoreboardDo over 1 together, then let them finish.Match the scoreboard.
48–53 minRecipe scalerIf time is short, add it to the homework.Scale the recipe.
53–58 minQuizRead each code aloud; vote, then check.Answer and read why.
58–60 minSet the after-class activityOpen the tracker boilerplate, agree a due date, and point to the homework pack.Copy the boilerplate.

Questions to ask

  • What is the difference between print(name) and print("name")?
  • Why does a good program use its variables instead of typing the numbers?
  • How do you swap two variables?

If it feels hard

Do level 1 and 2 tasks together, typing each line aloud. Give the activities one TODO at a time and press Check after each.

If it feels easy

Make a variable n = 4729 and print its digits backwards (9274) using only // and %, so it works for any 4-digit number.

FAQ

Practice class: print and variables (homework pack): questions

Is this Python practice right for Grade 6?

Yes. It is written for learners of about 11 and 12 who have met print() and variables. Each task has a warm-up, core and stretch level, so stronger learners are stretched too.

What is boilerplate code?

A ready-made program with the structure already written and TODO comments where the learner fills in a line or two. It keeps the focus on the idea being practised instead of a blank screen.

Can students do the homework on their own?

Yes. Every homework task runs on this page and checks itself, with clear messages when something is not right yet. A printable sheet is available too.

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