Commit 48d2b495 by BellCodeEditor

save project

parent d2b79974
Showing with 18 additions and 14 deletions
def er(): def er():
try: #定义一个列表,用来存放价格
total = [] total = []
while True: while True:
#提示用户输入,用unit变量接受输入的值
unit=int(input('请输入‘按q退出'))
if unit=='q':
break
else:
try:
unit=int(unit)
except:
print('请输入一个整数')
else:
total.append(unit)
print(total)
return total
except: er()
print('要输入整数')
\ No newline at end of file
else:
unit= int(input("请输入:"))
if unit== 'q':
break
else:
total.append(unit)
print(total)
er()
\ No newline at end of file
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