Commit bc4e408a by BellCodeEditor

auto save

parent 024fb164
Showing with 24 additions and 9 deletions
total = [] def total_price():
while True: total = []#创建空列表
unit= input("请输入:") while True:
if unit== 'q': unit=input("请输入[整数]:")
break if unit== 'q':
else: break
total.append(unit) else:
print(total) try:
\ No newline at end of file unit = int(unit)
except:
print('请重新输入整数')
else:
total.append(unit)
finally:
print("-"*30)
return total
# sum_1=0
# for i in total:
# sum_1=sum_1 +i
# print(sum_1)
total_price()
print(total)
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