diff --git a/func.py b/func.py new file mode 100644 index 0000000..5ab1494 --- /dev/null +++ b/func.py @@ -0,0 +1,29 @@ +def new_input(): + total = [] + while True: + money = input("请输入(q退出):") + if money == 'q': + break + else: + try: + money = int(money) + except: + print("请输入输入一个数字") + else: + total.append(money) + finally: + print("========================================") + return total + + +def sum (money) + count = 0 + for i in money: + count = count + i + range count + + +print = new_input() +new = sun(price) +print(您一共消费了多少元) + \ No newline at end of file