Hm! Is it allowed dictionary comprehension?
Of course, you will have to turn the digits from string to integers somewhere in the loop
Open the file and read it with the readlines method. This will create a list of the lines. Create an empty dict for the final result. Iterate over the lines and for each line: split the line the_dict[splited_line[0]] = dict(zip(['number','grade','total','weight'], splited_line[1:]))Done.
Of course, you will have to turn the digits from string to integers somewhere in the loop