我的老师给了我一项任务,其中一个问题要我将数组中的所有内容除以26.22(A full marathon)。我一整天都在做这件事,完全被困住了,有人可以告诉我如何做这个工作吗?
这是我迄今为止所拥有的
import string
forename = []
surname = []
distance = []
farthest_walk = []
marathon = []
#Opening the text file and sorting variables
data = open("members.txt","r")
for line in data:
value = line.split(',')
forename.append(value[0])
surname.append(value[1])
distance.append(value[2])
#Closing the text file
data.close()
Results = open("Results.txt","w+")
Results.write("The number of whole marathons walked be each member is:\n")
for count in range(len(distance)):
if float(distance[count])/ 26.22 = temp:
marathon.append
Results.write(forename[count]+":")
Results.write(surname[count]+":")
Results.write(marathon[count])
Results.close()
它应该作为结束Forename,Surname,WholeMarathosRun但我看不出它如何能到达那里。
子衿沉夜
相关分类