Commit c59ba5bf by BellCodeEditor

save project

parent 85a894d0
Showing with 6 additions and 3 deletions
......@@ -2,5 +2,8 @@ with open(r'c:\Users\86132\Desktop\lxh.txt','r',encoding='utf-8')as file:
a=file.readlines()
for x in a: #用for...in...把每一行数据遍历
data=x.split() #把字符串切分成更细的字符串
print(data[0]) #打印姓名
print(data[1:]) #打印义卖款
\ No newline at end of file
sum=0
for sales in data[1:]:
sum=sum+int(sales)
result=data[0]+str(sum)
print(result)
\ 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