Operator in python -10

 

# OPERATOR IN PYTHON

# 1.ARITHMETIC OPERATOR
# 2.ASSIGNMENT OPERATOR
# 3.COMPARISON OPERATOR
# 4.LOGICAL OPERATOR
# 5.IDENTITY OPERATOR
# 6.MEMBERSHIP OPERATOR
# 7.BITWISE OPERATOR

print("5+6 is",5+6)
print("5-6 is",5-6)
print("5*6 is",5*6)
print("5/6 is",10/3)
print("5//6 is",10//3) #divition with just integer value
print("2**3 is",2**3) #squere
print("5%3 is",5%3) #FOR REMINDER



print("ASSIGNMENT OPERATOR")
x=2
print(x)
x+=2 #x=x+2, i*=2,i/=2,i-=2,i%=2 can be write
print(x)




print("COMPARISON OPERATOR")
i=8
print(i==5)
print(i>5)
print(i<5)
print(i>=5)
print(i<=5)
print(i!=3)

print("LOGICAL OPERATOR")
a=True
b=False
print(a and b) #and operator

print(a or b) #or operator


print("IDENTITY OPERATOR")
print(a is not b) #true
print(5 is not 6)
print(2 is 2)
print(5 is not 5)

print("membership operator")
list=[3,2,4,5,6,7,8,9]
print(6 in list)
print(10 not in list)


print("bitwise opeator")

#in binary
#0-00
#1-01
#2-10
#3-11

print(0 & 1)
print(0 | 1)
print(0 | 3)








Comments

Popular posts from this blog

D WEB LINK