Commit c8c5e348 by BellCodeEditor

auto save

parent 6d226cff
Showing with 20 additions and 15 deletions
......@@ -6,21 +6,26 @@
# else:
# total.append(unit)
# print(total)
total = []
while True:
try:
unit = int(print("请输入价格:"))
def new_input():
total = []
while True:
unit = input("请输入菜品价格:")
if unit == "q":
break
except:
print("请输入数字奥")
else:
total.anpped(unit)
print(total)
else:
try:
unit = int(unit)
except:
print("请输入整数奥")
else:
total.append(unit)
print(total)
return total
result = new_input()
sum = 0
for i in range(len(result)):
sum = sum + result[i]
print("result的值为",result)
print(sum)
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