1) What do I need to do?
π― Your mission: Pizza party
4 heroes each eat 3 slices of pizza. A pizza has 8 slices.
Use variables and maths to print how many slices they eat and how many pizzas that is.
2) What do I need to know?
Python is a super calculator
+ add β’ - subtract β’ * multiply (star, not x!) β’ / divide
Dividing with / always gives a float, so 10 / 2 is 5.0.
Python does * and / before + and -, just like in school. Use brackets ( ) to choose what goes first.
π§° Your toolkit for this mission
Everything you need to know to finish this lesson on your own:
Maths symbols
Python is a super calculator.
How to write it: + add β’ - subtract β’ * multiply (a star, not x) β’ / divide.
print(4 * 3) # 12
Integer vs float results
/ always gives a float (a decimal). + - * with integers give integers.
How to write it: 10 / 2 gives 5.0. Use // for a whole-number answer: 10 // 3 gives 3.
print(10 / 2) # 5.0 print(10 // 3) # 3
Remainder %
% gives what's left over after dividing.
How to write it: 10 % 3 is 1 because 3 goes into 10 three times with 1 left.
print(17 % 5) # 2
Maths with variables
Store numbers in boxes, then do maths with the names.
How to write it: Use the names without quotes. Save the answer in a new variable.
heroes = 4 slices = 3 eaten = heroes * slices print(eaten) # 12
Brackets first
Python does * and / before + and -, just like school maths.
How to write it: Use brackets to choose the order: (2 + 3) * 4.
print((2 + 3) * 4) # 20
Think about it
Look at this code. What happens next, and why? Say it in your own words.
print(2 + 3 * 4) print((2 + 3) * 4)
Watch & explore βΆ
Power-up: Python is a super calculator
See it happen
1 / 3print(8 + 2) print(8 - 2)
Plus adds. Minus takes away.
3) Run the code & terminal output
Press βΆ RUN and your program's messages appear here!


Captain Py
Our next adventure is yours to create.
