def new_input(): total = [] while True: unit= input("请输入:") if unit== 'q': break else: try: unit = int(unit) except: print("请再次输入") else: total.append(unit) return total print(total) new_input() ftyyy = new_input() print(ftyyy) def sum(money): count = 0 for i in money(): count = count+i return count price = new_input() psh = sum(price) print("ythtrhfdhte" + str(psh) + "gffdsg")