forked from ainugiri/Python_Oct_25
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path004_operator.py
More file actions
89 lines (68 loc) · 1.55 KB
/
Copy path004_operator.py
File metadata and controls
89 lines (68 loc) · 1.55 KB
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
85
86
87
88
89
'''
arithetic : +, -, *, /, %
'''
a = 23
b = 20
print("Addition + ", a+b )
print("Sub -", a-b)
print("Modulus %", a%b)
print("Expo", 2**a)
print("Expo", 2**(1/2))
print("Expo", 2**(1/3))
print("Expo", 25**0.5)
# comparion
# int, float, str
# bool - 0,1 - True or False
isAvailable = True
print(type(isAvailable))
print("a is greater than b", a>b)
print(f"{a} is greater than {b}", a>b)
print("a is less than b statment is", a<b)
print(f"{a} is less than {b} statement is", a<b)
print(f"statement: {a} is equal to {b} is ", a==b)
print(f"statement: {a} is not equal to {b} is ", a!=b)
print(f"statement: {a} is greater than or equal to {b}", a>=b)
print(f"statement: {a} is less than or equal to {b}", a<=b)
# Logical operator
# bool bool AND OR NOT(bool1)
# True True True True False
# True False False True False
# False True False True True
# False False False False True
a = True
b = True
print(f"{a} and {b} \t", a and b)
print(f"{a} or {b}\t", a or b)
print(f'not({a})\t', not(a))
a = True
b = False
print(f"{a} and {b} \t", a and b)
print(f"{a} or {b}\t", a or b)
print(f'not({a})\t', not(a))
a = False
b = True
print(f"{a} and {b} \t", a and b)
print(f"{a} or {b}\t", a or b)
print(f'not({a})\t', not(a))
a = False
b = False
print(f"{a} and {b} \t", a and b)
print(f"{a} or {b}\t", a or b)
print(f'not({a})\t', not(a))
a = -10
b = 10
c = a+b-20
print(a<b and b<c)
# assignment operator
a = 10
b = 20
a = a + 20
print(a)
a += 20
print(a)
a = a - 10
print(a)
a -=10
print(a)
a*=10
print(a)