-
Notifications
You must be signed in to change notification settings - Fork 0
/
Addtion.py
36 lines (28 loc) · 983 Bytes
/
Addtion.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
def add():
from functools import reduce
f = input("Enter the numbers:\n")
lst = f.split("+")
print('the sum of {} is equals to {}'.format(
lst, reduce(lambda a, b: int(a)+int(b), lst)))
def subtract():
from functools import reduce
f = input("Enter the numbers:\n")
lst = f.split("-")
print('the subtraction of {} is equals to {}'.format(
lst, reduce(lambda a, b: int(a)-int(b), lst)))
def multiply():
from functools import reduce
f = input("Enter the numbers:\n")
lst = f.split("*")
print('the product of {} is equals to {}'.format(
lst, reduce(lambda a, b: int(a)*int(b), lst)))
def divide():
from functools import reduce
f = input("Enter the numbers:\n")
lst = f.split("/")
try:
print('the division of {} is equals to {}'.format(
lst, reduce(lambda a, b: int(a)/int(b), lst)))
except ZeroDivisionError:
print("Can't divide by zero: Undefined")
divide()