Course: Term 2: Math Wizard
Age Group: 9-10 years old
Duration: 60 minutes
Term: 2 of 8 | Week: 1 of 8
By the end of this lesson, you will be able to:
"Hey there, Math Wizard! ๐งโโ๏ธ Welcome to Term 2! Remember all those cool print() statements we made? Well, get ready because we're about to discover Python's SECRET SUPERPOWERโit's an AMAZING calculator! Seriously, Python can do math faster than the fastest human mathematician. And today, YOU get to unlock that power!"
In Term 1, you learned how to:
print()Now in Term 2, we're going to:
BrightByte says: "By the end of Term 2, you'll build your very own calculator app! How cool is that? Let's start by learning the basics of Python math!"
Computers were INVENTED to do math! The very first computers were just giant calculators. That's why programming languages like Python are incredibly fast at mathโit's what computers do best!
Fun Fact: Your computer can do about 1,000,000,000 (one BILLION) math calculations per second! That's faster than you can blink! ๐ฎ
Python uses special symbols for math. Here they are:
| Operation | Symbol | Example | Result |
|---|---|---|---|
| Addition | + | 5 + 3 | 8 |
| Subtraction | - | 10 - 4 | 6 |
| Multiplication | * | 6 * 7 | 42 |
| Division | / | 20 / 5 | 4.0 |
Important Notes:
* (the asterisk), NOT x/ (the forward slash)4.0 instead of 4)Addition is just like in regular math. Use the + sign!
print(5 + 3)
Output: 8
Python added 5 and 3 and showed us the answer!
print(100 + 250)
Output: 350
Python doesn't care how big the numbers areโit calculates instantly!
print(10 + 20 + 30 + 40)
Output: 100
You can add as many numbers as you want in one line!
print("I have", 5 + 3, "apples!")
Output: I have 8 apples!
Python does the math first, then shows it with your message!
Subtraction uses the - sign (the minus sign).
print(10 - 4)
Output: 6
print(1000 - 750)
Output: 250
print(5 - 10)
Output: -5
Python handles negative numbers perfectly! If you subtract a bigger number from a smaller number, you get a negative result.
print("I had 20 cookies.") print("I ate 8 cookies.") print("Now I have", 20 - 8, "cookies left!")
Output:
I had 20 cookies.
I ate 8 cookies.
Now I have 12 cookies left!
Multiplication uses the * symbol (asterisk). You can find it by pressing Shift + 8.
print(6 * 7)
Output: 42
print("5 times table:") print("5 x 1 =", 5 * 1) print("5 x 2 =", 5 * 2) print("5 x 3 =", 5 * 3) print("5 x 4 =", 5 * 4) print("5 x 5 =", 5 * 5)
Output:
5 times table:
5 x 1 = 5
5 x 2 = 10
5 x 3 = 15
5 x 4 = 20
5 x 5 = 25
# If there are 4 tables and 6 chairs at each table... print("Total chairs:", 4 * 6)
Output: Total chairs: 24
BrightByte says: "Remember: in Python, we use * for multiplication, NOT x. The x is used for other things in programming, so we use * instead!"
Division uses the / symbol (forward slash).
print(20 / 5)
Output: 4.0
Notice the .0 at the end? Division in Python always gives a decimal number (called a "float"), even when it divides evenly!
# 24 cookies shared among 6 friends print("Each friend gets", 24 / 6, "cookies!")
Output: Each friend gets 4.0 cookies!
print(10 / 3)
Output: 3.3333333333333335
When division doesn't come out even, Python gives you the full decimal answer!
# 1 pizza has 8 slices, shared among 3 friends print("Each person gets", 8 / 3, "slices")
Output: Each person gets 2.6666666666666665 slices
(Don't worryโwe'll learn how to round numbers later!)
Remember variables from Term 1? They're like labeled boxes that hold information. We can put numbers in variables and do math with them!
apples = 5 oranges = 3 total_fruit = apples + oranges print("Total fruit:", total_fruit)
Output: Total fruit: 8
level1_score = 100 level2_score = 150 level3_score = 200 total_score = level1_score + level2_score + level3_score print("Your total score is:", total_score)
Output: Your total score is: 450
coins = 50 print("You have", coins, "coins") # You find a treasure chest! coins = coins + 100 print("After finding treasure:", coins, "coins!") # You buy a power-up coins = coins - 25 print("After buying power-up:", coins, "coins!")
Output:
You have 50 coins
After finding treasure: 150 coins!
After buying power-up: 125 coins!
# Calculate the area of a rectangle length = 10 width = 5 area = length * width print("The rectangle is", length, "by", width) print("The area is", area, "square units")
Output:
The rectangle is 10 by 5
The area is 50 square units
BrightByte says: "Using variables for math is SUPER powerful! You can change the numbers once and the whole calculation updates. Real programmers use this all the time!"
Python follows the same order of operations you learn in math class! Here's a quick preview:
print(2 + 3 * 4)
Output: 14
Why? Python does 3 * 4 = 12 first, then 2 + 12 = 14.
print((2 + 3) * 4)
Output: 20
Why? Parentheses first! (2 + 3) = 5, then 5 * 4 = 20.
We'll learn MUCH more about this next week!
Write code to figure out the total:
lollipops = 12 chocolate = 8 gummy_bears = 15 total_candy = lollipops + chocolate + gummy_bears print("Total candy pieces:", total_candy)
You're ordering pizza for a party!
pizzas = 3 slices_per_pizza = 8 total_slices = pizzas * slices_per_pizza print("Total pizza slices:", total_slices)
You have 100 stickers to share equally among 4 friends. How many does each friend get?
stickers = 100 friends = 4 each_gets = stickers / friends print("Each friend gets", each_gets, "stickers!")
Create your own video game score tracker:
# My Video Game Score player_name = "SuperCoder" enemies_defeated = 25 points_per_enemy = 10 bonus_points = 50 total_points = (enemies_defeated * points_per_enemy) + bonus_points print("Player:", player_name) print("Enemies defeated:", enemies_defeated) print("Total points:", total_points)
| What You Want | Symbol | Example | Remember |
|---|---|---|---|
| Add | + | print(5 + 3) | Same as regular math! |
| Subtract | - | print(10 - 4) | Same as regular math! |
| Multiply | * | print(6 * 7) | Use *, NOT x |
| Divide | / | print(20 / 5) | Always gives decimal (.0) |
apples + oranges works great!print(5 + 3), Python does the math, then prints| Word | Definition | Example |
|---|---|---|
| Operator | A symbol that tells Python what math to do | +, -, *, / |
| Expression | A math problem Python can solve | 5 + 3 |
| Float | A number with a decimal point | 4.0, 3.5 |
| Integer | A whole number (no decimal) | 4, 10, 100 |
| Calculate | To figure out the answer to a math problem | Python calculates 5+3 |
Week 2: Bigger Math!
Next week, you'll discover even MORE math powers:
**%Sneak peek:
# Exponents - powers! print(2 ** 10) # 2 to the power of 10 = 1024! # Modulo - remainders! print(17 % 5) # 17 divided by 5 has remainder 2!
Get ready to become a REAL Math Wizard! ๐งโโ๏ธ
You just learned how to turn Python into your personal calculator!
What you accomplished today:
+, -, *, /BrightByte says: "WOW! You just unlocked Python's calculator superpowers! ๐ฆธ From now on, you never need to do math by hand againโjust ask Python! But here's the cool part: this is just the beginning. Next week, we're going to learn even MORE powerful math tricks. You're doing AMAZING! Keep practicing, and I'll see you next week!"
Want to practice more? Try these fun challenges:
KidsLearnAI - Empowering the Next Generation with AI Education
www.kidslearnai.ca
Instagram: @kids_learn_ai
Questions? Stuck on something? Don't worry! Ask your instructor or parent for help. Remember: asking questions is how all great coders learn!
Sign in to track your progress
๐ก Tip: Save your Trinket.io projects to share with friends and teachers!
Starter Code:
# Python Does Math!
# Let's turn Python into a super-calculator!
# Try these math problems:
print(5 + 3)
print(10 - 4)
print(6 * 7)
print(20 / 5)
# Now try your own!
Quick Start Guide: