cal_func.py 734 字节
# @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