Lab Program 9
Lab Program 9
Develop a program that uses class Student which prompts the user to enter marks in three
subjects and calculates total marks, percentage and displays the score card details. [Hint: Use list to
store the marks in three subjects and total marks. Use init method to initialize name, USN and the
lists to store marks and total, Use getMarks() method to read marks into the list, and display()
method to display the score card details.]
class Student:
self.name = name
self.usn = usn
self.marks = []
self.total_marks = 0
self.percentage = 0.0
def getMarks(self):
for i in range(3):
self.marks.append(mark)
self.total_marks += mark
self.percentage = self.total_marks / 3
def display(self):
print("Name:", self.name)
print("USN:", self.usn)
print("Marks:", self.marks)
print("Percentage:", self.percentage)
name = input("Enter student name: ")
student.getMarks()
student.display()