The document discusses various types of operators in Python including arithmetic, relational, logical, bitwise, assignment, and special operators. It provides examples of using each type of operator and the expected output. Specifically, it gives code samples that use arithmetic operators to add, subtract, multiply and divide numbers, relational operators to compare values, logical operators to combine conditional statements, bitwise operators like AND, OR, XOR on integers, and membership operators to check if a value is contained within a sequence.
11. e) Bitwise shift right & left
int main() {
int num= 212, i;
for (i = 0; i <= 2; ++i) {
printf(“right shift by %d: %dn”, i, num >> i);
}
Printf(“n”);
for (i = 0; i <= 2; ++i) {
printf(“left shift by %d: %dn”, i, num << i);
}
Return 0;
}
OUTPUT
12. 5. EXAMPLE OF ASSIGNMENT OPERATOR
NAME=(“SOUVAGYA BERA”)
Print(NAME)
OUTPUT
13. 6. SPECIAL OPERATOR
A . EXAMPLE OF IDENTITY OPERATOR
al =5
bl =5
a2 ="hello"
b2 ="hello"
a3 =[1,2,3]
b3 =[1,2,3]
print(al is not bl)
print(a2 is b2)
print(a2 is b3)
OUTPUT
14. B. EXAMPLE OF MEMBERSHIP OPERATOR
a= “hello world”
b= “{1,"a","b",2}”
Print("H" in a)
Print("hello" in a)
Print(1 in b)
Print("b" in b)
Print("c" not in b)
OUTPUT