-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPyCalc.py
78 lines (73 loc) · 1.79 KB
/
PyCalc.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
def calcHelp():
print("Calculator Help :")
print("Only accepted values :")
print("1 - Addition of two numbers")
print("2 - Subtraction of two numbers")
print("3 - Multiplication of two numbers")
print("4 - Division of two numbers")
def boolHelp():
print("Boolean Help :")
print("Only accepted values :")
print("1 - Greater than.")
print("2 - Less than.")
print("3 - Equal to.")
print("4 - Not equal to.")
print("5 - Greater than or Equal to.")
print("6 - Less than or Equal to.")
def globalHelp():
calcHelp()
boolHelp()
a = input("Which one would you Like to open: ")
x = input("Type The First Number : ")
y = input("Type The Second Number : ")
z = input("Type The Operation : ")
x1 = int(x) # Makes the x an integer.
y1 = int(y) # Makes the y an integer.
if z == "1": #Addition and Greater than.
if a == "Calc":
b = x1 + y1
elif a == "Bool":
b = x1 > y1
else:
b = int(0)
elif z == "2": #Minus and Less than.
if a == "Calc":
b = x1 - y1
elif a == "Bool":
b = x1 < y1
else:
b = int(0)
elif z == "3": #Multiply and equal to.
if a == "Calc":
b = x1 * y1
elif a == "Bool":
b = x1 == y1
else:
b = (0)
elif z == "4": #Division and not equal to .
if a == "Calc":
b = x1 / y1
elif a == "Bool":
b = x1 != y1
else:
b = int(0)
elif z == "5": # Null and Greater than or equal to.
if a == "Calc":
pass
elif a == "Bool":
b = x1 >= y1
else:
b = int(0)
elif z == "6" : #Null and Less than or equal to.
if a == "Calc":
pass
elif a == "Bool":
b = x1 >= y1
else:
b = int(0)
elif z == "?": #Help
b = int(0)
if b == 0:
globalHelp()
else :
print(b)