forked from sacredsliver/calc
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinput.py
More file actions
52 lines (36 loc) · 936 Bytes
/
input.py
File metadata and controls
52 lines (36 loc) · 936 Bytes
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
import model
in_a = input('Введите число А = ')
in_b = input('Введите число Б = ')
oper = input('Введи знак операции(*/-+) = ')
def inp_operans():
if 'i' in in_a and 'i' in in_b:
model.init(a, b, True)
elif '/' in in_a and '/' in in_b:
model.init(a, b, False)
else:
return False
return True
def calc(oper):
if '*' in oper:
result = model.mult()
elif '+' in oper:
result = model.sum()
elif '-' in oper:
result = model.sub()
elif '/' in oper:
result = model.div()
else:
print('оператор не верный')
return result
def log(data):
with open('log.txt', 'w') as file:
file.write(data)
def view(data):
print(data)
def run():
if inp_operans():
result = calc(oper)
else:
result = False
log(result)
view(result)