Python Numbers & Arithmetic Operators
Computers are fundamentally calculators on rocket fuel. Python comes with full arithmetic support out of the box: addition, subtraction, multiplication, decimal division, floor division, modulo (remainder), and exponents.
"Standard math operators work just like your school calculator. The extra superpowers are // (floor division: tells you how many whole pizzas everyone gets) and % (modulo: tells you how many slices are left over)."
Deep Dive: How It Works
Basic math: + (addition), - (subtraction), * (multiplication), / (standard division). Note that / always produces a float result in Python 3 (e.g. 10 / 2 gives 5.0).
Floor Division (//): Divides two numbers and chops off any decimal remainder, returning the largest integer (e.g. 7 // 2 gives 3).
Modulo (%): Returns the remainder of division (e.g. 7 % 2 gives 1). Super useful for checking if a number is even (num % 2 == 0) or cycling through items.
Exponentiation (**): Raises a number to a power (e.g. 2 ** 3 is 2 cubed = 8). Note: Python uses ** for powers, not ^ (which is bitwise XOR).
Order of Operations: Python strictly follows PEMDAS (Parentheses, Exponents, Multiplication/Division, Addition/Subtraction). Use parentheses ( ) to clarify your intent.
Syntax Blueprint
result = 10 + 5 # Add (15) result = 10 // 3 # Floor divide (3) result = 10 % 3 # Remainder (1) result = 2 ** 4 # Power (16)
Standard arithmetic symbols with // for integer division and ** for power.
Core Rules to Remember



Common Beginner Traps & How to Fix Them
Using ^ for exponentiation: 2 ^ 3Why it happens: In math notation ^ means power, but in Python ^ is the bitwise XOR operator (2 ^ 3 = 1).
How to fix: Always use double asterisks ** for power calculations (2 ** 3 = 8).
Live Interactive Example
Hit Run Code to see it liveYour Turn: Micro Challenge
No pressure! Edit the starter code below and test your solution with instant feedback.
Calculate remaining cookies
You have 23 cookies and want to split them equally among 4 friends.
Use the modulo operator % to calculate and print the remaining cookies.
Finished reading and practicing?
Mark this lesson as completed to update your course progress.