Unit-1_PythonOperators
Unit-1_PythonOperators
1. Arithmetic operators
2. Comparison operators
3. Assignment Operators
4. Logical Operators
5. Bitwise Operators
6. Membership Operators
7. Identity Operators
Arithmetic Operators
print(4 << 2)
print(5 << 3)
Bitwise Operators
print(4 >> 2)
print(5 >> 2)
Membership operators
● NOT IN OPERATOR:-it returns true if the object is not present in a given sequence.
● Otherwise it return false.
● Example of NOT In OPERATOR:-
Tuple =(11,15,21,29,50,70)
num=15
If num not in tuple:
print(“number is present”)
else:
print(“number is not present”)
IDENTITY OPERATORS
● Identity operators check whether the value of two variable is the same or
not.
● This operator is known as reference - quality operators.
● Because the identity operators compares value according to two variable
memory addresses
● Python has 2 identity operators is and is not
IDENTITY OPERATORS
Associativity:
Associativity defines the order in which operators of the same precedence level are
evaluated in an expression. It determines whether operations are performed from left to
right or right to left.
Example:
2. result = (4 + 6) * (2 ** 3) / 5 - 7 % 3
print(result)
5. result = 8 * 3 + 2 - 12 // 4 ** 2 // (5 % 3) + 1 - 6 - 2 * 1 + 1 ** 2
print(result)
Answers:
1.90.0
2.15.0
3.True
4.17.0
5.20
Que 6:
Que:7
Que:8