Lesson 6 of 13

Operators: Make Code Calculate!

Operators are the symbols that let your code do math, compare values, and make decisions. You already know them — from school!

+Add
Subtract
×Multiply
÷Divide
==Equal
>Greater
🤔 What is an Operator?

Symbols That Do Things!

Operators tell your code what action to take — just like in maths class!

When I first started coding, I was so happy — I already knew operators from school! +, -, ×, ÷ — I used them every day in maths. In code, they work the same way. You give the computer two numbers and an operator — it gives you the answer instantly!

10 Number
+
5 Number
=
15 Result!

📚 Types of Operators

4 Types Every Kid Should Know!

Each type has a different job — let’s learn them all!

🔢

Arithmetic Operators — Do the Maths!

These are the ones you know from school! They add, subtract, multiply, and divide numbers. Simple and powerful!

+ Add 5 + 3 = 8
Subtract 9 – 4 = 5
* Multiply 3 * 4 = 12
/ Divide 10 / 2 = 5
% Remainder 7 % 3 = 1
** Power 2 ** 3 = 8
# Arithmetic operators in Python
score = 10 + 5   # → 15
lives = 3 - 1    # → 2
total = 4 * 3    # → 12
half  = 10 / 2   # → 5.0
⚖️

Comparison Operators — Compare Two Things!

These compare two values and always give you True or False. Used with if/else to make decisions!

== Equal to 5==5 → True
!= Not equal 5!=3 → True
> Greater 7>3 → True
< Less than 2<9 → True
>= Greater/eq 5>=5 → True
<= Less/equal 3<=4 → True
# Comparison — always True or False!
age = 12
print(age == 12)   # True
print(age > 18)    # False
print(age != 10)   # True
📌

Assignment Operators — Store Values!

These store values inside variables. The = sign doesn’t mean “equal” here — it means “put this value into the box”!

= Assign x = 5
+= Add & store x += 3
-= Sub & store x -= 2
*= Mul & store x *= 4
# Score tracking with += !
score = 0
score += 10   # score is now 10
score += 5    # score is now 15
print(score)   # → 15
🧠

Logical Operators — Combine Decisions!

These combine two True/False conditions into one answer. Used to check multiple things at once!

and Both true? T and T→T
or Either true? T or F→T
not Flip it! not T→F
# Logical operators with if/else
age = 12
has_ticket = True

if age >= 10 and has_ticket:
    print("You can enter! 🎉")

🎮 Try the Calculator!

Interactive Operator Calculator!

Pick numbers, pick an operator — see the result instantly!

🖩 Code Calculator

Build an expression and hit = to calculate!

_ ? _
?
🔍 Comparison Results (auto-updates)
==?
!=?
>?
<?
>=?
<=?

⚔️ Operator Battle!

Guess the Missing Operator!

Look at the expression — pick the right operator to complete it!

⚡ Operator Battle Game

8 rounds · find the missing operator!

Loading… What operator goes in the box?
Score: 0 / 0

🧠 Quick Quiz!
🎯 Operators Quiz

4 questions · pick an answer to check!

⭐ Remember This!

Arithmetic operators do maths: +, -, *, /

⚖️

Comparison operators return True or False

📌

= means “store this value” — not “is equal to”!

🧠

and/or/not combine True/False conditions together