Skip to main content
MahiDev — Learn. Build. Become AI-ready.

Module 05

Operators and Expressions

Learn how Python expressions are formed using different operators.

Beginner3 hours9 lessons

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.

Beginner12 min

02

Arithmetic Operators

Perform addition, subtraction, multiplication, true division, floor division, modulo, and exponentiation in Python.

Beginner18 min

03

Assignment Operator

Assign values with =, multi-target assignment, swap without a temp variable, and short-hand operators like += and *=.

Beginner15 min

04

Relational Operators

Compare two values with >, <, ==, !=, >=, and <=. Every relational expression returns True or False — the building blocks for if and logical operators.

Beginner12 min

05

Logical Operators

Combine relational tests with and, or, and not. Learn truth tables, short-circuit evaluation, and why 100 and 200 returns 200.

Beginner25 min

06

Bitwise Operators

Work on integers bit by bit with <<, >>, &, |, ^, and ~. Floats are not allowed; the same symbols also mean set operations.

Beginner22 min

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.

Beginner18 min

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.

Beginner20 min

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.

Beginner12 min