Commit ef3705be by BellCodeEditor

save project

parent b6cd2718
Showing with 3 additions and 25 deletions
def new_input():
total = []
while True:
unit= input("请输入:")
if unit== 'q':
break
else:
try:
unit= int(unit)
except:
print('请输入整数~')
else:
total.append(unit)
print(total)
return total
def sum(money):
sum = 0
for i in money:
sum+=i
return sum
total=new_input()
num=sum(total)
print(num)
\ No newline at end of file
files=open(r"C:\Users\win10\Desktop\1.txt",'w',encoding='utf-8')
files.write("小兰:12本\n小丽:11本\n李文:9本\n张伟:16本")
files.close()
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