Python Lecture2
Python Lecture2
Python’s Operators
print(x>y) False
print(x<y) True
print(x>=y) False
print(x<=y) True
print(x==y) False
print(x!=y)
True
Logical operators
x=5 x=5 =
x=x+5 x+=5 =+
x=x-5 x-=5 =-
x=x*5 x*=5 =*
x=x/5 x/=5 =/
x=x%5 x%=5 =%
print(x) 27
x**=3
print(x)
Membership operators
print(“h”in x) True
print(“py”not in x) False
print(3 in y) True
print([1] in y) False