I need help writing a program that reads about 300 lines from a text file and takes the grades from a specific assignment (column A1) and then uses the grades from that assignment to plot a histogram in quickdraw.
ID , Last, First, Lecture, Tutorial, A1, A2, A3, A4, A5
8959079, Moore, Maria, L01, T03, 9.0, 8.5, 8.5, 10.0, 8.5
4295498, Taylor, John, L00, T04, 10.0, 6.5, 8.5, 9.5, 7.0
9326386, Taylor, David, L00, T00, 9.5, 8.0, 8.0, 9.0, 10.0
7223234, Taylor, James, L01, T03, 8.5, 5.5, 10.0, 0.0, 0.5
7547838, Miller, Robert, L01, T09, 7.0, 8.0, 8.5, 10.0, 0.5
0313453, Lee, James, L01, T01, 10.0, 0.5, 8.0, 7.0, 5.0
3544072, Lee, Helen, L00, T03, 10.0, 9.0, 7.0, 9.0, 8.5
So far I have a code that extracts the grades from the file(A1) and puts it into a list and then creates another that counts how many occurrences of a certain grade occur. I am having trouble now using this list and inputing it into quickdraw to plot a histogram?
def file():
file = open('sample_input_1.txt', 'r')
col = [] data = file.readlines()
for i in range(1,len(data)-1):
col.append(int(float(data[i].split(',')[5])))
return col
def hist(col):
grades = []
for i in range(11):
grades.append(0)
for i in (col):
grades[i] += 1
return grades
col = file()
grades = hist(col)
print(col)
print(grades)