class Student:
def __init__(self, name, marks):
self.name = name
self.marks = marks
seld.grade = ""
def calculateGrade(self):
if self.marks < 40:
self.grade = "D"
elif self.marks < 60:
self.grade = "C"
else:
self.grade = "A"
def displayGrade(self):
print(self.name)
print("Grade - ")
print(self.grade)
class School:
def __init__(self):
self.students = []
def addStudent(self, student):
self.students.append(students)
def findTopper(seld):
if not self.students:
return None
topper = self.student[0]
for student in self.students:
if student.marks > topper.marks:
topper = student
return topper
school1 = School()
s1 = Student("Aman", 75)
s1.calculateGrade()
s2 = Student("Rahul", 92)
s2.calculateGrade()
s3 = student("Priya", 68)
s3.calculateGrade()
school1.addStudent(s1)
school1.addStudent(s2)
school1.addStudent(s3)
topper = school.findTopper()
print( "Topper is -")
print(topper.name)
print(topper.name)
print("Marks:", topper.marks)
topper.displayGrade()