Operators
Python has the familiar arithmetic and comparison operators, but uses readable English keywords — and, or, not — instead of symbols for logical operations. Python also adds ** for exponentiation and // for floor (integer) division.
💡 Key insight
Python's // operator always rounds down (floors) the result, even for negative numbers — a subtle detail worth remembering.
Syntax
syntax
a + b a - b a * b a / b a % b a ** b a // b
a == b a != b a > b a < b
a and b a or b not aExample
** raises a number to a power; // divides and rounds down to the nearest whole number.
py
a = 10
b = 3
print("Sum:", a + b)
print("Power:", a ** 2)
print("Floor div:", a // b)
print("Is greater:", a > b)outputSum: 13
Power: 100
Floor div: 3
Is greater: True
Try it yourself
Copy this example into the Python compiler and run it — try changing a value and see what happens.
