Commit ebd13ea6 by BellCodeEditor

save project

parent b0a7aa15
Showing with 7 additions and 28 deletions
def new_input():
total = []
while True:
unit= input("请输入:")
if unit== 'q':
break
else:
try:
money=int(money)
except:
print("请输入重新一个数字")
else:
total.append(unit)
finally:
print("-"*30)
return total
def sum(money):
count=0
for i in money:
count+=i
return count
price=new_input()
pay=sum(price)
print("需要支付"+str(pay)+"元!")
\ No newline at end of file
filel= open(r'C:\Users\yaoji\Desktop\book.txt','w',encoding='utf-8')
filel.write('大狒狒:12根\n')
filel.write('小狒狒:6根\n')
filel.write('巨狒狒:30根\n')
filel.write('大胖狒狒:20根\n')
filel.close()
\ 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