Commit ebd13ea6 by BellCodeEditor

save project

parent b0a7aa15
Showing with 7 additions and 28 deletions
def new_input(): filel= open(r'C:\Users\yaoji\Desktop\book.txt','w',encoding='utf-8')
total = [] filel.write('大狒狒:12根\n')
while True: filel.write('小狒狒:6根\n')
unit= input("请输入:") filel.write('巨狒狒:30根\n')
if unit== 'q': filel.write('大胖狒狒:20根\n')
break filel.close()
else: \ No newline at end of file
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
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