My class did this Unit Assessment last year and I taught them a number of ways of reading data from files.
When the data is comma delimited (I used a txt file, not a csv, but I’m sure it’d work the same way), I use the .split(“,”) function. This creates a new list with three items in it (name at index 0, coursework mark at index 1, prelim mark at index 2). I then append the three values in that list to three separate lists.
The code is something like this (the formatting will be messed up, but you’ll get the idea):
myFile = open(“Class_Marks.txt”, “r”)
names = []
cws = []
prelims = []
for line in myFile:
-tab-splitList = line.strip().split(“,”) #.strip() takes out the new line character at the end
-tab-names.append(splitList[0])
-tab-cws.append(splitList[1])
-tab-prelims.append(splitList[2])
Hopefully that code works (I typed it from memory so there are likely some mistakes).