-
Notifications
You must be signed in to change notification settings - Fork 0
/
pymath.py
38 lines (33 loc) · 900 Bytes
/
pymath.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
def add(*args):
res = sum(args)
return res
def subtract(num1, num2):
res = num1 - num2
return res
def multiply(num1, num2):
res = num1 * num2
return res
def divide(num1, num2):
res = num1 / num2
return res
def floor_divide(num1, num2):
res = num1 // num2
return res
def math(num1, op, num2):
if op == "+":
res = sum(num1, num2)
return res
elif op == "-":
res = num1 - num2
return res
elif op == "*" or op.lower == "x":
res = num1 * num2
return res
elif op == "/":
res = num1 / num2
return res
elif op == "//":
res = num1 // num2
return res
else:
print("Error. Operator unknown. Try again.")