Commit 6c1301bf by BellCodeEditor

auto save

parent 6d88eca4
Showing with 25 additions and 0 deletions
def collect_price():
total=[]
while True:
unit=input("输入价格:")
if unit == 'q':
break
try:
unit=int(unit)
except:
print("价格是数字")
else:
total.append(unit)
return total
def sum(ptotal):
count=0
for i in ptotal:
count=count+i
return count
total=collect_price()
psum=sum(total)
print(psum)
\ 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