#operators in python
#arithimatic operators
print("the value of 746 + 97346 is :",746 + 97346)
print("the value of 4568 - 987 is :",4568 - 987)
print("the value of 3*5 is :",3*6)
print("the value of 343**232 :",343**232)
fa = 343**232
print (len(fa))
#assignment operators
x = 4
print(x)
x%=4
print(x)
x-=4
print(x)
x*=4
print(x)
#comparison operator
a=42
print (a==43);print(a==22);print(a==42)
#identify operator
print(5 is not 5)
print("faizan" is not "faizan")
print("faizan" is "faizan")
print("faizan" is not "fai")
#membership operator
list = [2,3,4,5,2,4,5,5,6,7]
print(2 not in list)
print(5 not in list)
print(23 in list)
print(2 in list)
#bitwise operators
print(0|1)
print(1|1)
print(1&0)
a=23
b=34
c=53
d=63
e=12
f=54
print(a|b);print(b|c);print(c|d);print(d|e);print(e|f);print(f|a);print(b|f);print(c|e)
print(a&b);print(b&c);print(c&d);print(d&e);print(e&f);print(f&a);print(b&f);print(c&e)
print(~a);print(~~a);print(~d)
Comments
Post a Comment