Commit 9641b07f by BellCodeEditor

save project

parent db1e4e09
Showing with 7 additions and 7 deletions
def new_input(): def new_input():
total = [] total = []
while True: while True:
money= input("请输入:") unit= input("请输入:")
if money== 'q': if unit== 'q':
break break
else:
try: try:
money = int(money) unit = int(unit)
except: except:
print("请输字") print("请输字")
else: else:
total.append(money) total.append(unit)
finally: finally:
print("-"*100) print("====================")
return total return total
def sum(money): def sum(money):
...@@ -21,6 +21,6 @@ def sum(money): ...@@ -21,6 +21,6 @@ def sum(money):
count = count + i count = count + i
return count return count
result = new_input() price = new_input()
pay = sum(price) pay = sum(price)
print("你消费了" + str(pay) + "") print("你消费了" + str(pay) + "")
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment