Kids Learn AI Logo
Lesson 1: Python Does Math! โœจ
Discover Python's super-calculator powers - learn addition, subtraction, multiplication, and division

Term 2, Lesson 1: Python Does Math! ๐Ÿงฎ

Course: Term 2: Math Wizard
Age Group: 9-10 years old
Duration: 60 minutes
Term: 2 of 8 | Week: 1 of 8


๐ŸŽฏ What You'll Learn Today

By the end of this lesson, you will be able to:

  • Use Python as a super-powerful calculator
  • Perform addition, subtraction, multiplication, and division
  • Do math with numbers directly and with variables
  • Understand why computers are so fast at math
  • Create programs that calculate and display results

๐Ÿค– Welcome Back from BrightByte!

"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!"

What's Special About Term 2?

In Term 1, you learned how to:

  • Make Python talk using print()
  • Store information in variables
  • Create fun text-based programs

Now in Term 2, we're going to:

  • Turn Python into a super-calculator
  • Get information FROM users
  • Build interactive programs that do REAL math

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!"


๐Ÿ”ข Python: The Super-Calculator

Why Is Python So Good at 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! ๐Ÿ˜ฎ

The Four Basic Operations

Python uses special symbols for math. Here they are:

OperationSymbolExampleResult
Addition+5 + 38
Subtraction-10 - 46
Multiplication*6 * 742
Division/20 / 54.0

Important Notes:

  • For multiplication, we use * (the asterisk), NOT x
  • For division, we use / (the forward slash)
  • Division always gives a decimal answer (like 4.0 instead of 4)

โž• Addition: Putting Things Together

Addition is just like in regular math. Use the + sign!

Example 1: Simple Addition

print(5 + 3)

Output: 8

Python added 5 and 3 and showed us the answer!

Example 2: Adding Bigger Numbers

print(100 + 250)

Output: 350

Python doesn't care how big the numbers areโ€”it calculates instantly!

Example 3: Adding Many Numbers

print(10 + 20 + 30 + 40)

Output: 100

You can add as many numbers as you want in one line!

Example 4: Addition with a Message

print("I have", 5 + 3, "apples!")

Output: I have 8 apples!

Python does the math first, then shows it with your message!


โž– Subtraction: Taking Things Away

Subtraction uses the - sign (the minus sign).

Example 1: Simple Subtraction

print(10 - 4)

Output: 6

Example 2: Bigger Subtraction

print(1000 - 750)

Output: 250

Example 3: Going Negative!

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.

Example 4: Subtraction Story

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: Groups of Things

Multiplication uses the * symbol (asterisk). You can find it by pressing Shift + 8.

Example 1: Simple Multiplication

print(6 * 7)

Output: 42

Example 2: Times Tables!

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

Example 3: Real World Multiplication

# 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: Sharing Equally

Division uses the / symbol (forward slash).

Example 1: Simple Division

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!

Example 2: Sharing Cookies

# 24 cookies shared among 6 friends print("Each friend gets", 24 / 6, "cookies!")

Output: Each friend gets 4.0 cookies!

Example 3: Division with Remainders

print(10 / 3)

Output: 3.3333333333333335

When division doesn't come out even, Python gives you the full decimal answer!

Example 4: Pizza Slices

# 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!)


๐ŸŽฏ Math with Variables

Remember variables from Term 1? They're like labeled boxes that hold information. We can put numbers in variables and do math with them!

Example 1: Storing Numbers

apples = 5 oranges = 3 total_fruit = apples + oranges print("Total fruit:", total_fruit)

Output: Total fruit: 8

Example 2: Game Score

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

Example 3: Changing Variables

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!

Example 4: Calculating Area

# 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!"


๐Ÿ”„ Order of Operations (Sneak Peek!)

Python follows the same order of operations you learn in math class! Here's a quick preview:

Multiplication and Division First

print(2 + 3 * 4)

Output: 14

Why? Python does 3 * 4 = 12 first, then 2 + 12 = 14.

Use Parentheses to Change Order

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!


๐ŸŽฎ Practice Time!

Challenge 1: The Candy Store

Write code to figure out the total:

  • 12 lollipops
  • 8 chocolate bars
  • 15 gummy bears
lollipops = 12 chocolate = 8 gummy_bears = 15 total_candy = lollipops + chocolate + gummy_bears print("Total candy pieces:", total_candy)

Challenge 2: The Pizza Party

You're ordering pizza for a party!

  • 3 pizzas
  • Each pizza has 8 slices
  • How many total slices?
pizzas = 3 slices_per_pizza = 8 total_slices = pizzas * slices_per_pizza print("Total pizza slices:", total_slices)

Challenge 3: Fair Sharing

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!")

Challenge 4: Video Game Stats

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)

๐Ÿ“ Key Takeaways

The Four Math Operators

What You WantSymbolExampleRemember
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)

Important Things to Remember

  1. Use * for multiplication โ€” NOT the letter x
  2. Division gives decimals โ€” Even 10/2 gives 5.0
  3. Variables work in math โ€” apples + oranges works great!
  4. Python calculates first โ€” In print(5 + 3), Python does the math, then prints

Vocabulary Words

WordDefinitionExample
OperatorA symbol that tells Python what math to do+, -, *, /
ExpressionA math problem Python can solve5 + 3
FloatA number with a decimal point4.0, 3.5
IntegerA whole number (no decimal)4, 10, 100
CalculateTo figure out the answer to a math problemPython calculates 5+3

๐ŸŒŸ Next Lesson Preview

Week 2: Bigger Math!

Next week, you'll discover even MORE math powers:

  • Exponents โ€” Making numbers HUGE with **
  • Modulo โ€” Finding remainders with %
  • PEMDAS โ€” The secret order of operations

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! ๐Ÿง™โ€โ™‚๏ธ


๐ŸŽ‰ Great Job, Math Wizard!

You just learned how to turn Python into your personal calculator!

What you accomplished today:

  • โœ… Learned the four math operators: +, -, *, /
  • โœ… Did addition, subtraction, multiplication, and division
  • โœ… Used variables to store and calculate numbers
  • โœ… Combined math with print() statements
  • โœ… Got a preview of order of operations

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!"


๐Ÿ“š Extra Practice Ideas

Want to practice more? Try these fun challenges:

  1. Times Table Generator: Print out your favorite times table (like 7x1, 7x2, 7x3...)
  2. Money Calculator: If you have $20 and each toy costs $3, how many toys can you buy? How much money is left?
  3. Sports Stats: Track points scored in different quarters of a game
  4. Recipe Doubler: If a recipe uses 3 eggs and 2 cups of flour, what would you need to double it?

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

Lesson not completed

๐Ÿ’ก 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:

  1. Copy the starter code above (click the "Copy Code" button)
  2. Click the "Open Trinket.io" button above to open it in a new tab
  3. Paste the code into the Trinket.io editor
  4. Click "Run" to execute your code
  5. Experiment, modify, and have fun!