It only catches the comparison to average for the first name and i need to strip the new line.
Can you help?
Can you help?
Code:
scores = []
names = []
infile = open("bowlingscores.txt", "r")
for i, line in enumerate(infile):
if i % 2 == 1:
scores.append(int(line))
else:
names.append(line)
average = float(sum(scores) / len(scores))
print (names)
print (scores)
outfile = open("bowlingaverages.txt", "w")
for s in zip(names, scores):
if scores > average:
scores = "above average"
elif scores < average:
scores = "below average"
else:
scores = "perfect"
outfile.write("%s" % names)
outfile.write("%s" % scores)
Comment