Today in this lesson we’ll see the students mark lists program in python and also how to write the students mark lists program in python. But before start writing the program we’ll go through one short introduction about the mark lists. So,

What is Mark List?

The mark list is the type of list which consist of all the data of students’ marks scored in the exam. To remember the marks of 10 students is a very easy task. But, to remember the marks of more than 10 students is impossible. So, to make this task easier the mark list comes into the picture. With the help of python, we’ll design one program which will store all the marks data of students in one place.

With the help of Mark List, the task of remembering the marks becomes very easy. The teacher can easily find which student has scored how many marks in the exam.

The mark list also consists of the overall data of the students. For example, the grades, and average marks scored in each and every subject.

There are also chances to lose the overall data of the academic year, so the data lists are the better option to maintain the data.

Nowadays all the schools and colleges are digitalized and started using advanced software to maintain the academic record of each and every student.

Now we’ll see how to write the student’s mark lists program in python.

Students Mark Lists Program in Python

#Learnprogramo - programming made simple
# Defining a class student, which contain name, Roll number and marks of the student.
class Student(object):
    def __init__(self, name, roll, marks):
        self.name = name
        self.roll = roll
        self.marks = marks
    
    def getmarks(self):
        return self.marks
    
    def getroll(self):
        return self.roll
    
    def __str__(self):
        return self.name + ' : ' + str(self.getroll()) +'  ::'+  str(self.getmarks())
  
# Defining a function for building a Record 
# which generates list of all the students    
def Markss(rec, name, roll, marks):
    rec.append(Student(name, roll, marks))
    return rec
# Main Code
Record = []
x = 'y'
while x == 'y':
    name = input('Enter the name of the student: ')
    height = input('Enter the roll number: ')
    roll = input('Marks: ')
    Record = Markss(Record, name, roll, height)
    x = input('another student? y/n: ')
# Printing the list of student
n = 1
for el in Record:
    print(n,'. ', el)
    n = n + 1

Output:

students mark lists program in python,student mark list program in python using for loop,student mark list program in python using dictionary

Explanation:

In the above program, we’ve defined one class named Student which will consist of functions and constructors. After executing the program the compiler will ask you to enter the details of the student such as the Name, Marks, and the roll no of the student.

Here we’ve used the built-in function called class() which creates the student’s mark lists. With the help of the while loop, the program compiles continuously till we enter n as input. The while loop gets executed continuously if we give the input as ‘y’. The condition while x == ‘y’ gets satisfied when we give input as ‘y’.

At last, all the details get printed using the print() function.

Conclusion

In this way, we’ve learned how to write students mark lists program in python. If you’ve any doubts then please feel free to contact us. We’ll reply to your mail as soon as possible.

Thanks and Happy Coding 🙂

Also Read: