Operators in python are the special symbols that are used to perform operations on operands. Operators are special symbols in Python that carry out arithmetic or logical computation. The value that the operator operates on is called the operand

Types of Operators in Python

1 ) Arithmetic Operators.

2 ) Assignment Operators.

3) Relational Operators.

4) Logical Operators.

5 ) Membership Operators.

6 ) Identity Operators.

7 ) Bitwise Operators.

The following table contains the arithmetic operators that are used to perform arithmetic operations.

```
a=56;
b=12;
print(a//b)
print(a+b)
print(a-b)
print(a*b)
print(a%b)
print(a/b)
```

4 68 44 672 8 4.666666666666667

Operators | Description |

// | Perform Floor division(gives integer value after division) |

+ | Used for addition |

- | used to perform subtraction |

* | used to perform multiplication |

/ | used to perform division |

% | used to return remainder after division(Modulus) |

** | Perform exponent(raise to power) |

The following table contains the assignment operators that are used to assign values to the variables.

```
#example of assignment operators
x=50 # = is assignment operator
y=1
y+=40 # arithmetic assignment operator
x-=20 # arithmetic assignment operator
z=3 # arithmetic assignment operator
z*=40 # arithmetic assignment operator
p=10 # arithmetic assignment operator
p//=2 # arithmetic assignment operator
#Printing the values of the variables
print(x)
print(y)
print(z)
print(p)
```

30 41 120 5

Operators | Description |

= | Assignment |

/= | Divide and Assign |

+= | Add and assign |

-= | Subtract and Assign |

*= | Multiply and assign |

%= | Modulus and assign |

**= | Exponent and assign |

//= | Floor division and assign |

There operators are mostly used to perform comparison.

```
x=6
y=9
print(x==y)
print(x>y)
print(x<y)
print(x!=y)
print(x>=y)
```

False False True True False

Operator | Meaning |

> | Greater that - True if left operand is greater than the right |

< | Less that - True if left operand is less than the right |

== | Equal to - True if both operands are equal |

>= | Greater than or equal to - True if left operand is greater than or equal to the right |

<= | Less than or equal to - True if left operand is less than or equal to the right |

!= | Not equal to - True if operands are not equal |

Logical operators are the and, or, not operators.

```
x= True
y = False
# Output: x and y is False
print('x and y is',x and y)
# Output: x or y is True
print('x or y is',x or y)
# Output: not x is False
print('not x is',not x)
```

x and y is False x or y is True not x is False

Operator | Meaning |

and | True if both the operands are true |

or | True if either of the operands is true |

not | True if operand is false (complements the operand) |

History of python programming Python Keywords Python Lines and Indentation Features of Python Python Operators Python Variables and Types Python Comments Application Areas of Python First Python Program Python Identifiers Installing python Python Coding Style Python Programming Tutorial Python Literals What is Python Setting Python Path