-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOld_Calculator.py
More file actions
33 lines (26 loc) · 1.01 KB
/
Old_Calculator.py
File metadata and controls
33 lines (26 loc) · 1.01 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
29
30
31
32
33
x = int(input('Please enter x: '))
y = int(input('Please enter y: '))
operator = input('Do you want to add(+), subtract(-), multiply(*), or divide(/)?: ')
def addition(x, y):
return x + y
def subtraction(x, y):
return x - y
def multiplication(x, y):
return x * y
def division(x, y):
return x / y
# Now that we have defined our relative functions. This is the operational logic of our program.
if operator == 'add' :
print('Addition of ', x, ' and ', y, ' is ', addition(x, y))
elif operator == 'subtract' :
print('Subtraction of ', x, ' and ', y, ' is ', subtraction(x, y))
elif operator == 'multiply' :
print('Multiplication of of ', x, ' and ', y, ' is ', multiplication(x, y))
elif operator == 'divide':
print('Addition of ', x, ' and ', y, ' is ', division(x, y))
else:
print('Operator Gonzo! Try Again')
# print('Addition is ' , addition(4, 4))
# print('Subtraction is ' , subtraction(4, 4))
# print('Multiplication is ' , multiplication(4, 4))
# print('Division is ' , division(4, 4))