TarSh8654 commited on
Commit
b87fa64
·
verified ·
1 Parent(s): efa616a

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +88 -0
app.py ADDED
@@ -0,0 +1,88 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ def add(a, z):
2
+
3
+ return a + z
4
+
5
+
6
+
7
+ # This function takes two numbers and subtracts them.
8
+
9
+ def subtract(a, z):
10
+
11
+ return a - z
12
+
13
+
14
+
15
+ # This function takes two numbers and multiplies them.
16
+
17
+ def multiply(a, z):
18
+
19
+ return a * z
20
+
21
+
22
+
23
+ # This function takes two numbers and divides them.
24
+
25
+ def divide(a, z):
26
+
27
+ return a / z
28
+
29
+
30
+
31
+
32
+ print("Select operation.")
33
+
34
+ print("1.Addition")
35
+
36
+ print("2.Subtraction")
37
+
38
+ print("3.Multiplication")
39
+
40
+ print("4.Division")
41
+
42
+
43
+
44
+ while True:
45
+
46
+ # Take input from the user
47
+
48
+ choice = input("Enter choice(1/2/3/4): ")
49
+
50
+
51
+
52
+ # Check to see if your choice is one of the four options
53
+
54
+ if choice in ('1', '2', '3', '4'):
55
+
56
+ numb1 = float(input("Enter first number: "))
57
+
58
+ numb2 = float(input("Enter second number: "))
59
+
60
+
61
+
62
+ if choice == '1':
63
+
64
+ print(numb1, "+", numb2, "=", add(numb1, numb2))
65
+
66
+
67
+
68
+ elif choice == '2':
69
+
70
+ print(numb1, "-", numb2, "=", subtract(numb1, numb2))
71
+
72
+
73
+
74
+ elif choice == '3':
75
+
76
+ print(numb1, "*", numb2, "=", multiply(numb1, numb2))
77
+
78
+
79
+
80
+ elif choice == '4':
81
+
82
+ print(numb1, "/", numb2, "=", divide(numb1, numb2))
83
+
84
+ input()
85
+
86
+ else:
87
+
88
+ print("Invalid Input")