Hiring Partners
Segilola Resources Operating LimitedTaviatech TechnologiesFCMBMTN NigeriaAdvans La Fayette Microfinance BankAboki AfricaFirst Bank of NigeriaOPay
โ† PYTHON FUNDAMENTALS LEVEL ONE PROFESSIONAL ยท Lesson 4 of 8

Module Three

๐Ÿ“– Every lesson in this course is free to read right here, no account needed. Create a free account to track your progress, take the exam, and earn your certificate.
4
Module 3 ยท Operators & Expressions ยท Python for 13-year-olds

โž• Module 3 ยท Operators & Expressions

๐Ÿง‘โ€๐ŸŽ“ for 13-year-olds math & logic magic ยท 45 min
๐Ÿงฎ + ยท - ยท * ยท / ยท == ยท and

Ready to make Python crunch numbers and make decisions? ๐Ÿค– Operators are the symbols that tell Python what to do โ€” like + (add), * (multiply), or > (is bigger than). An expression is any combo of values and operators that produces a result. We use them for maths, comparisons, and even clever logic. Let's go!

1

Arithmetic operators ๐Ÿ”ข

These are the maths operators you already know โ€” plus a few extra-cool ones:

OperatorNameExampleResult
+Add7 + 29
-Subtract7 - 25
*Multiply7 * 214
/Divide7 / 23.5
//Floor divide7 // 23 (rounds down)
%Modulo (remainder)7 % 21
**Power7 ** 249
print(10 + 3 * 2) # 16 (multiplication first!)
print(2 ** 10) # 1024
print(17 % 5) # 2 โ† the remainder
๐ŸŽฎ Modulo is a gaming legend: it helps make things repeat โ€” like choosing every 2nd player in a turn.
2

Order of operations (PEMDAS) ๐Ÿ“

Python follows the same rules as maths class โ€” PEMDAS! This decides which part runs first in an expression.

๐Ÿง  Remember: PEMDAS

P ยท Parentheses ( ) E ยท Exponents ** M ยท Multiply * D ยท Divide / // % A ยท Add + S ยท Subtract -
print(2 + 3 * 4) # 14 (not 20!)
print((2 + 3) * 4) # 20 (brackets win!)
print(2 ** 3 + 1) # 9
๐Ÿ’ก Tip: When unsure, add brackets! It makes your code clearer for humans too.
3

Comparison operators โš–๏ธ

These compare two values and give back a boolean (True or False). Perfect for making decisions!

OperatorMeansExampleResult
==Equal to5 == 5True
!=Not equal5 != 3True
>Greater than7 > 4True
<Less than7 < 4False
>=Greater or equal7 >= 7True
<=Less or equal3 <= 2False
print(10 == 10) # True
print(10 != 10) # False
print(99 > 100) # False
print("apple" == "apple") # True (works on text too!)
โš ๏ธ Watch out: = is for saving a value. == is for comparing. They are NOT the same!
4

Logical operators ๐Ÿง 

These combine booleans: and, or, and not. Theyโ€™re how computers make complex decisions.

OperatorRuleExampleResult
andBoth must be TrueTrue and FalseFalse
orAt least one TrueTrue or FalseTrue
notFlips itnot TrueFalse
# Game logic examples
has_key = True
door_locked = False
print(has_key and not door_locked) # True โ€” you can enter!

is_weekend = True
is_holiday = False
print(is_weekend or is_holiday) # True โ€” no school!
๐ŸŽฏ Think of it this way: and = both boxes must be ticked. or = just one box needs a tick.
5

Assignment shortcuts ๐Ÿ“

You already know =. But Python has shortcuts that update a variable and save the result back into it.

ShortcutSame asExample
+=x = x + ...score += 10
-=x = x - ...lives -= 1
*=x = x * ...coins *= 2
//=x = x // ...total //= 2
score = 0
score += 50 # score is now 50
score += 25 # score is now 75
lives = 3
lives -= 1 # lives is now 2
print(f"Score: {score}, Lives: {lives}")
6

Mix them like a pro ๐ŸŽ›๏ธ

Real programs combine arithmetic, comparison, and logic. Hereโ€™s a mini boss-check for a game:

player_level = 15
has_sword = True
boss_level = 20

# Can you fight the boss?
can_fight = (player_level >= 15) and has_sword
print("Ready for battle?", can_fight)

# Deal extra damage when strong
damage = 10 * (player_level // 5)
print(f"Your damage: {damage}") # 30
๐Ÿงฉ Brackets are your friend: (player_level >= 15) and has_sword is easier to read than without them.

๐Ÿ† Mini challenge: Pizza party calculator

Create a file called pizza_party.py. Youโ€™re organising a pizza party! Each pizza has 8 slices, and each friend eats 3 slices. Use operators to figure out:

  • How many full slices are left over after the friends eat (use %).
  • How many whole pizzas you need if 5 friends come (use // and round up).
  • Whether you have enough slices for everyone (use >= and and).
# Starter code โ€“ fill in the blanks!
slices_per_pizza = 8
slices_per_friend = 3
friends = 5

total_needed = friends * slices_per_friend
# Your code here โ€“ use //, %, >=, and
print("Slices needed:", total_needed)

๐Ÿ• Bonus: print a fun message using an f-string that includes the result of a comparison!

๐Ÿง‘โ€๐Ÿซ Remember: Operators are tools. Play with them in the REPL โ€” try 2 ** 64 and see how big it gets!

๐Ÿ† Get Certified

๐Ÿ”’

Earn this certificate

Every lesson is already free to read. Sign up, finish the lessons, pass the exam (โ‚ฆ2,000 or 20,000 coins), and get a verified certificate with your name on it.

๐ŸŽ“ Sign Up to Get Certified
๐Ÿ› ๏ธ Practice Tools
Hands-on simulators & labs - subscription required.
โ†’
๐ŸŽฏ Internship Tasks
Real-world tasks to build your portfolio - unlock them with a subscription.
โ†’