-
Notifications
You must be signed in to change notification settings - Fork 110
/
calculator.py
38 lines (28 loc) · 872 Bytes
/
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
print("Type '+', '-', '*', '/' for the operation to be used")
operation = input("What kind of operation you want to solve? ")
firstNumber = int(input("Enter your first number: "))
secondNumber = int(input("Enter your second number: "))
def calculator():
if (operation == "+"):
add(firstNumber, secondNumber)
elif (operation == "-"):
subtract(firstNumber, secondNumber)
elif (operation == "*"):
multiply(firstNumber, secondNumber)
elif (operation == "/"):
divide(firstNumber, secondNumber)
else:
print("Please enter correct operation to be used")
def add(a, b):
addition = a + b
print(addition)
def subtract(a, b):
minus = a - b
print(minus)
def multiply(a, b):
multiplication = a * b
print(multiplication)
def divide(a, b):
division = a / b
print(division)
calculator()