cal_func.py
734 字节
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
# @Time :2020/10/22 9:43
# @Author :dengyuting
# @File :cal_func.py
# 计算产品总价
def cal_orderPrice(univalence, *args):
sum = 0
for num in args:
sum = sum + univalence * num
return sum
def cal_Ratio(ratio, univalence, *args):
price = cal_orderPrice(univalence, *args)
sum = ratio/100 * price
# print(str(int(sum)))
return str(int(sum))
# cal_Ratio(10,15,300)
def add(x, y):
"""
对两个数相加
:param x:
:param y:
:return:
"""
return int(int(x)+int(y))
def str_to_int(*args):
'''
对接收的元组求和
:param args:
:return:
'''
num = 0
for i in range(len(args)):
num = num + int(args[i])
return num