-
Notifications
You must be signed in to change notification settings - Fork 0
/
c_calcyl.py
27 lines (22 loc) · 787 Bytes
/
c_calcyl.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
# модуль для расчетов операций
import cmath
def Calc_block(data):
left_value, oper, right_value = data
if oper == '+':
return sum(left_value, right_value)
if oper == '-':
return sub(left_value, right_value)
if oper == '*':
return mult(left_value, right_value)
if (oper =='/') and (right_value != 0):
return div(left_value, right_value)
else:
return 'Ошибка деления на 0!'
def sum(left_value, right_value):
return left_value + right_value
def sub(left_value, right_value):
return left_value - right_value
def mult(left_value, right_value):
return left_value * right_value
def div(left_value, right_value):
return left_value / right_value