Types Of Operators In Python-
- 1) Arithmatic operators
- 2) Relational Operator
- 3) Logical operators
1) Arithmatic Operators-
+,-,*,/(Divison),//(Floor divison),**(Exponant operator) 5/2 = 2.5 5%2 = 1(Remainder) 5//2 = Floor(2.5) = 2 >>> 7/3 2.3333333333333335 >>> 7%3 1(Remainder) >>> 7//3 # Floor(2.33) = 2 2 >>> 3**3 27 >>> 3**4 81 >>> """ Below is not the operator but if we have a requirement to get the floor value of given no. We can use floor function from math module. math.floor(2.3) = 2 math.floor(2.9) = 2 math.ceil(2.1) = 3 """
2) Relational Operator-
<, >, <=, >=, == , != = is not the relational Types Of Operators In Python- It is assignment operator which is used to assign the value.
Ex- >>> 4>7 False >>> 4<7 True >>> 4==7 False >>>
Note- There is no concept of i++ or i– in Python. If we want to increment or decrement the value then we have to use i= i+1 or i=i-1
3) Logical Operators-
- – Logical operators are And, OR, Not.
- – Logical operator evaluate the relation between two operands.
- – Always return True or False value.