Commit c5692a07 by BellCodeEditor

auto save

parent 77b7c9c5
Showing with 9 additions and 5 deletions
def a(): def a():
total = [] total = 0
total1=[]
while True: while True:
unit=input("请输入单价:") unit=input("请输入单价:")
if unit=='q': if unit=='q':
print('现在总计为:'+str(total))
return unit
break break
else: else:
try: try:
...@@ -12,12 +11,17 @@ def a(): ...@@ -12,12 +11,17 @@ def a():
except: except:
print('请输入整数!') print('请输入整数!')
else: else:
total.append(int(unit)) total+=unit
total1.append(int(unit))
print('现在总计为:'+str(total)) print('现在总计为:'+str(total))
print('各计单价为:'+str(total1))
finally: finally:
print('-'*30) print('-'*30)
print('总计为:'+str(total))
print('各计单价为:'+str(total1))
print('-'*30)
return total
while True: while True:
a() a()
......
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