Lesson 1: Introduction to the Course

2 Topics
Lesson 2: Python Basics

4 Topics | 1 Quiz
Lesson 3: Control Structures

3 Topics | 1 Quiz
Lesson 4: Data Structures – Introduction

3 Topics | 1 Quiz
Lesson 5: Functions and Modules

4 Topics | 1 Quiz
Lesson 6: Object-Oriented Programming (OOP)

4 Topics | 1 Quiz
Lesson 7: Exception Handling

4 Topics | 1 Quiz
Lesson 8: Intermediate Python Constructs

3 Topics | 1 Quiz
Lesson 9: File Operations and I/O

3 Topics | 1 Quiz
Lesson 10: Python Libraries and Frameworks

3 Topics | 1 Quiz
Lesson 11: Web Development with Python

3 Topics | 1 Quiz
Lesson 12: Python for Data Analysis

3 Topics
Lesson 14: Advanced Topics

3 Topics
Operators are the backbone of any programming language, allowing you to perform operations on variables and values. Python boasts a wide range of operators, from basic mathematical ones to more complex logical and bitwise operations.

Used for performing mathematical operations.

**Addition (**: Adds two numbers.`+`

)python`x = 5 + 3 # x is 8`

**Subtraction (**: Subtracts the right operand from the left.`-`

)python`x = 5 - 3 # x is 2`

**Multiplication (**: Multiplies two numbers.`*`

)python`x = 5 * 3 # x is 15`

**Division (**: Divides the left operand by the right operand.`/`

)python`x = 8 / 2 # x is 4.0 (result is float)`

**Modulus (**: Returns the remainder when the left operand is divided by the right operand.`%`

)python`x = 10 % 3 # x is 1`

**Exponentiation (**: Raises the left operand to the power of the right operand.`**`

)python`x = 2 ** 3 # x is 8`

**Floor Division (**: Divides and returns the integer value of the quotient. It dumps the digits after the decimal.`//`

)python`x = 9 // 2 # x is 4`

Used for comparing values.

**Equal (**: Checks if the value of two operands is equal.`==`

)python`(5 == 5) # True`

**Not Equal (**: Checks if the value of two operands is unequal.`!=`

)python`(5 != 3) # True`

**Greater Than (**: Checks if the left operand is greater than the right operand.`>`

)python`(5 > 3) # True`

**Less Than (**: Checks if the left operand is less than the right operand.`<`

)python`(3 < 5) # True`

**Greater Than or Equal to (**: Checks if the left operand is greater than or equal to the right operand.`>=`

)python`(5 >= 5) # True`

**Less Than or Equal to (**: Checks if the left operand is less than or equal to the right operand.`<=`

)python`(4 <= 5) # True`

Used to combine conditional statements.

**and**: Returns True if both statements are true.python`(5 > 3 and 7 > 4) # True`

**or**: Returns True if one of the statements is true.python`(5 < 3 or 7 > 4) # True`

**not**: Reverse the logical state of the operand.python`not(5 > 3) # False`

Used to assign values to variables.

: For example,`=`

,`+=`

,`-=`

,`*=`

,`/=`

,`%=`

,`//=`

,`**=`

`x += 3`

is the same as`x = x + 3`

.

Used to test whether a value or variable is in a sequence.

**in**: Returns True if a value is found in a sequence.python`x = [1, 2, 3, 4] 3 in x # True`

**not in**: Returns True if a value is not found in a sequence.python`y = "Hello" "z" not in y # True`

Used to compare the objects, not if they are equal, but if they are the same object, with the same memory location.

**is**: Returns True if both variables are the same object.python`x = [1, 2, 3] y = x x is y # True`

**is not**: Returns True if both variables are not the same object.python`a = [1, 2, 3] b = [1, 2, 3] a is not b # True`

Understanding the usage and nuances of operators in Python is fundamental for building logical operations and algorithms. These tools, while simple on their own, are powerful when combined, allowing developers to design sophisticated and efficient solutions to complex problems.

By grasping the essentials of Python operators, developers can effectively manipulate data, construct logical sequences, and build efficient Python programs.