Arithmetic Operators in Python
Arithmetic operators perform mathematical calculations on numbers. Python has the familiar +, -, * and / for addition, subtraction, multiplication, and division, plus a few operators most languages don't have as built-ins: // for floor division, % for the remainder (modulo), and ** for exponentiation.
Two operands, one result
Each operator takes two numbers and produces one value.
Standard precedence applies
Multiplication and division run before addition and subtraction, unless parentheses say otherwise — covered fully in Operator Precedence.
Mixing int and float promotes to float
Any expression combining the two types produces a float result.
True division always returns a float
/ returns a float even when the numbers divide evenly, unlike // which stays an int when both operands are ints.
Floor division and modulo are a pair
a // b gives how many times b fits into a; a % b gives what is left over — together they reconstruct a.
print(7 + 3)print(7 - 3)print(7 * 3)print(7 / 3)print(7 // 3)print(7 % 3)print(7 ** 2)Addition (+)
Combines two numbers — or concatenates two strings or lists, covered in their own topics.
total = 12 + 8print(total)Floor Division (//)
Divides and rounds down to the nearest whole number, discarding any remainder.
full_boxes = 23 // 5print(full_boxes)Modulo (%)
Returns the remainder of a division — a common way to check divisibility or cycle through a fixed range.
is_even = 10 % 2 == 0print(is_even)Exponentiation (**)
Raises a number to a power.
squared = 5 ** 2print(squared)Recommended resourcesAffiliate links · may earn us a commission
Recommended for learners
Practice what you learned
Re-implement each visualized algorithm in Python yourself — building beats watching.