IDLE python

class Student:
def init(self, name, marks): = name
self.marks = marks

def get_name(self):

def get_marks(self):
    return self.marks

class MarksAnalysis:
def init(self, students):
self.students = students

def calculate_average_marks(self):
    total_marks = 0
    for student in self.students:
        total_marks += student.get_marks()
    return total_marks / len(self.students)

def calculate_highest_marks(self):
    highest_marks = 0
    highest_marks_student = None
    for student in self.students:
        if student.get_marks() > highest_marks:
            highest_marks = student.get_marks()
            highest_marks_student = student
    return highest_marks, highest_marks_student

def calculate_lowest_marks(self):
    lowest_marks = float('inf')
    lowest_marks_student = None
    for student in self.students:
        if student.get_marks() < lowest_marks:
            lowest_marks = student.get_marks()
            lowest_marks_student = student
    return lowest_marks, lowest_marks_student

def display_marks_analysis(self):
    print("Marks Analysis Report:")
    print(f"Number of Students: {len(self.students)}")
    print(f"Average Marks: {self.calculate_average_marks()}")
    highest_marks, highest_marks_student = self.calculate_highest_marks()
    print(f"Highest Marks: {highest_marks} (Student: {highest_marks_student.get_name()})")
    lowest_marks, lowest_marks_student = self.calculate_lowest_marks()
    print(f"Lowest Marks: {lowest_marks} (Student: {lowest_marks_student.get_name()})")

Creating student objects

students = [
Student(“Alice”, 85),
Student(“Bob”, 92),
Student(“Charlie”, 78)

Creating marks analysis object

marks_analysis = MarksAnalysis(students)

Displaying marks analysis report


can you edit this programe according to class 9