Commit bc4e408a by BellCodeEditor

auto save

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