-
Notifications
You must be signed in to change notification settings - Fork 0
/
operators.py
84 lines (69 loc) · 1.2 KB
/
operators.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
x=10
y=20
print("ARITHMATIC OPERATORS")
print(x,y)
print(x+y)
print(x-y)
print(x*y)
print(x/y)
print(x**y)
print(x//y)
print(x%y)
print("")
print("ASSIGNMENT OPERATORS")
x+=6
print(x,"Addition")
x-=6
print(x,"Subtraction")
x*=6
print(x,"Multipilcation")
x/=6
print(x,"division")
x%=6
print(x,"modules")
y&=6
print(y,"And operation")
y|=6
print(y,"OR Operation")
y^=6
print(y,"XOR Operation")
y>>=2
print(y,"left shift")
y<<=2
print(y, "Right Shift")
print(g:=3)
print("")
print("COMPARISION OPERATORS")
print("x==y",x==y)
print("x>=y",x>=y)
print("x<=y",x<=y)
print("x!=y",x!=y)
print("x>y",x>y)
print("x<y",x<y)
print("")
print("LOGICAL OPERATORS")
a=10
b=50
print(a,b)
print( "Logical and",a>1 and b>49)
print( "Logical or", a>45 or b<49)
#print("Logical not", not a=10)
print("")
print("IDENTITY OPERATOR")
print(a is b,"is operator")
print(a is not b,"is not operator")
print("MEMBERSHIP OPERATOR")
p=["Afiyah", "Gayatri"]
print(p)
print("Afiyah" in p,"is operator")
print("Afiyah" not in p,"is not operator")
print("")
print("BITEWISE OPERATOR")
m=10
n=20
print(m&n)
print(m|n)
print(m^n)
print(~m)
print(m>>n)
print(m<<n)