- Operators are used to perform simple operations such as additions, comparisons etc on variables and values.
- Python supports the following types of operators, we will be looking at some of the commonly used operators.
![image.png](https://dphi-live.s3.amazonaws.com/media_uploads/image_b17068aa56274bcda2ed0b51718edcfc.png)
Arithmetic Operators
We can perform some basic arithmetic operations such as addition, subtraction, multiplication, etc. using Python.
Example:
x = 2
y = 3
x + y # addition
x * y # multiplication
![Snapshot of basic arithmetic operations on notebook](https://dphi-live.s3.amazonaws.com/media_uploads/image_54b7816bcb134626824828be1c32bb25.png)
Aritmetic Operators: Meanings & Examples
![image.png](https://dphi-live.s3.amazonaws.com/media_uploads/image_cd7745922ce34255a3989bd0867f1af0.png)
Comparison Operator
- These are used to compare two values
- Gives a Boolean result (True/False)
![image.png](https://dphi-live.s3.amazonaws.com/media_uploads/image_04182e5a65504239b6989b2bd387a2aa.png)
Comparison Operators: Meanings & Examples
![image.png](https://dphi-live.s3.amazonaws.com/media_uploads/image_8055279765c442dd9aae62d7a886b065.png)
Logical Operator
- Logical operators are used to combine conditional statements
- Gives a Boolean result (True/False)
![image.png](https://dphi-live.s3.amazonaws.com/media_uploads/image_fa30ccd13cc64f66a0fd323f95911470.png)
![image.png](https://dphi-live.s3.amazonaws.com/media_uploads/image_b74cdcaeb9b74f87bab25a8241f28bc1.png)