How can create functions of class which one of them can add mark and another read from file to add that mark depend on id to the list of mark?

if you have the following data enter image description here

Where, the first column is the student id, the second one is the name, the third one is the level and the rest of the numbers are marks (a variable number of marks).
1- Create a file called students to store the data. (do it manually) enter image description here

2- Create a class called students that receives the student id, name and level. This class has two methods; the first one to add one mark to the list of student marks (called add_mark) and the other one to return student’s information (called dump) 3- Write a function called ‘create_student’. This function will receive a file name and an id, then it will read the file and create one student from the corresponding row and add his marks.

Read more here:

Content Attribution

This content was originally published by amera2020 at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: