Notes / Python / Operators

Operators in Python — Revision Notes

A quick-reference cheat sheet: definition, syntax, example, common mistakes and an interview tip.

beginner 📖 2 min revision

Definition

📌 Operators Python has the familiar arithmetic and comparison operators, but uses readable English keywords — and, or, not — instead of symbols for logical operations.

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 a

Example

py
a = 10
b = 3
print("Sum:", a + b)
print("Power:", a ** 2)
print("Floor div:", a // b)
print("Is greater:", a > b)

Output

outputSum: 13 Power: 100 Floor div: 3 Is greater: True

Important Points

Common Mistakes

Interview Tip

🎯 Before your interview Be ready to explain the difference between / and // in Python 3 — a common quick interview check.
Back to notes Read full lesson →