Module 05
Operators and Expressions
Learn how Python expressions are formed using different operators.
01
What Are Operators and Expressions?
Learn what an operator is, how expressions are formed, and the seven operator families using visual references and real Python examples.
02
Arithmetic Operators
Perform addition, subtraction, multiplication, true division, floor division, modulo, and exponentiation in Python.
03
Assignment Operator
Assign values with =, multi-target assignment, swap without a temp variable, and short-hand operators like += and *=.
04
Relational Operators
Compare two values with >, <, ==, !=, >=, and <=. Every relational expression returns True or False — the building blocks for if and logical operators.
05
Logical Operators
Combine relational tests with and, or, and not. Learn truth tables, short-circuit evaluation, and why 100 and 200 returns 200.
06
Bitwise Operators
Work on integers bit by bit with <<, >>, &, |, ^, and ~. Floats are not allowed; the same symbols also mean set operations.
07
Membership Operators (`in` / `not in`)
Check whether a value exists in an iterable with in and not in. Strings use substrings; dicts check keys by default.
08
Identity Operators (`is` / `is not`)
Compare object identity with is and is not — memory addresses, not just values. Learn alias vs copy and when to use is with None.
09
Ternary Operator (if ... else)
Python does not use the C/Java ternary operator ?:. Learn Python's if ... else expression to choose one of two values.