-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPython Calculator.py
More file actions
28 lines (26 loc) · 1.04 KB
/
Copy pathPython Calculator.py
File metadata and controls
28 lines (26 loc) · 1.04 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
# :::::::::::::::::::::::::::::::::[ Calculator ]:::::::::::::::::::::::::::::::::: #
ao = input("Select a operation(A,S,M,D): ")
first_digit = float(input("Enter 1st digit: "))
second_digit = float(input("Enter 2nd digit: "))
if ao == "M" or ao == "m":
def multiply(number1, number2):
return number1 * number2
result = float(multiply(first_digit, second_digit))
print("Answer: "+str(result))
elif ao == "D" or ao == "d":
def division(number1, number2):
return number1 / number2
result = float(division(first_digit, second_digit))
print("Answer: "+str(result))
elif ao == "A" or ao == "a":
def addition(number1, number2):
return number1 + number2
result = float(addition(first_digit, second_digit))
print("Answer: "+str(result))
elif ao == "S" or ao == "s":
def subtract(number1, number2):
return number1 - number2
result = float(subtract(first_digit, second_digit))
print("Answer: "+str(result))
else:
print("Please choose the right operation to perform: ")