My problem is that the average value on this won't show up as it returns as an error
Traceback (most recent call last):
(file location), line 29, in <module>
average_score = [[x[8],x[0]] for x in a_list]
(file location), line 29, in <listcomp>
average_score = [[x[8],x[0]] for x in a_list]
IndexError: list index out of range
the code
import csv
class_a = open('class_a.txt')
csv_a = csv.reader(class_a)
a_list = []
for row in csv_a:
row[3] = int(row[3])
row[4] = int(row[4])
row[5] = int(row[5])
minimum = min(row[3:5])
row.append(minimum)
maximum = max(row[3:5])
row.append(maximum)
average = sum(row[3:5])//3
row.append(average)
a_list.append(row[0:8])
print(row[8])
this clearly works when I test out the values 0 to 7 ,even if I change the location of the avarage sum I still get the error