-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCalculator.py
54 lines (45 loc) · 1.45 KB
/
Calculator.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
#!/bin/python3
# This script was made by Lmmp04 and uploaded to github.com
# Created in 2022 to practice learning simple python coding
print ("[A]ddition")
print ("[S]ubtraction")
print ("[M]ultiplication")
print ("[D]ivision")
print ("")
ans = input("Which of these operations would you like to use? : ").strip().lower()
if ans == "a":
print ('\n')
ans1 = float(input("What is the first number you would like to add? : "))
print ('\n')
ans2 = float(input("What is the second number you would like to add? : "))
adding = ans1 + ans2
print ('\n')
print ("The sum is : ")
print (adding)
if ans == "s":
print ('\n')
ans1 = float(input("What is the first number you would like to subtract? : "))
print ('\n')
ans2 = float(input("What is the second number you would like to subtract? : "))
subtracting = ans1 - ans2
print ('\n')
print ("The difference is : ")
print (subtracting)
if ans == "m":
print ('\n')
ans1 = float(input("What is the first number you would like to multiply : "))
print ('\n')
ans2 = float(input("What is the second number you would like to multiply : "))
multiplying = ans1 * ans2
print ('\n')
print ("The product is : ")
print (multiplying)
if ans == "d":
print ('\n')
ans1 = float(input("What is the first number you would like to divide? : "))
print ('\n')
ans2 = float(input("What is the second number you would like to divide? : "))
dividing = ans1 / ans2
print ('\n')
print ("The quotient is : ")
print (dividing)