-
Notifications
You must be signed in to change notification settings - Fork 0
/
7.1.py
71 lines (51 loc) · 1.16 KB
/
7.1.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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
def mul(x,y):
result={'s':None, 'm':None}
result['s']=x['s']*y['s']
result['m']=x['m']*y['m']
return result
def sum(x,y):
result={}
result['s']=x['s']*y['m']+x['m']*y['s']
result['m']=x['m']*y['m']
return result
def dev(x,y):
result={'s':None, 'm':None}
result['s']=x['s']*y['m']
result['m']=x['m']*y['s']
return result
def sub(x,y):
result={}
result['s']=x['s']*y['m']-x['m']*y['s']
result['m']=x['m']*y['m']
return result
a={}
b={}
a_s=int(input('enter s for a..'))
a['s']=a_s
a_m=int(input('enter m for a..'))
a['m']=a_m
b_s=int(input('enter s for b..'))
b['s']=b_s
b_m=int(input('enter m for b..'))
b['m']=b_m
print('1-multiply')
print('2-sum')
print('3-subtraction')
print('4-devide')
print('5-exit')
while True:
choice=int(input('please enter your choice: '))
if choice==1:
r=mul(a,b)
print(r)
elif choice==2:
r=sum(a,b)
print(r)
elif choice==3:
r=dev(a,b)
print(r)
elif choice==4:
r=sub(a,b)
print(r)
elif choice==5:
exit()