3-5. Operators

Operators are fundamental in programming as they enable you to perform various operations on variables and values. Python supports several types of operators, including arithmetic, comparison, logical, bitwise, assignment, identity, and membership operators.

Arithmetic Operators

Arithmetic operators are used to perform common mathematical operations.

Comparison Operators

Comparison operators compare two values and return a Boolean result (True or False).

Logical Operators

Logical operators are used to combine conditional statements.

Bitwise Operators

Bitwise operators are used to perform bit-level operations on integers.

Assignment Operators

Assignment operators are used to assign values to variables.

Practical Examples

You can combine different types of operators to create complex expressions.

Operators are often used in conditional statements to control the flow of the program.