OneCompiler

fds 2

177

def average_score(marks):
return sum(marks) / len(marks) if len(marks) > 0 else 0

def highest_and_lowest_score(marks):
if not marks:
return None, None
return max(marks), min(marks)

def absent_students_count(marks):
return marks.count(0)

def mark_with_highest_frequency(marks):
if not marks:
return None
return max(set(marks), key=marks.count)

Example usage:

marks_list = [75, 88, 92, 60, 75, 88, 0, 92, 75, 75]

avg = average_score(marks_list)
highest, lowest = highest_and_lowest_score(marks_list)
absent_count = absent_students_count(marks_list)
freq_mark = mark_with_highest_frequency(marks_list)

print("a) Average score of the class:", avg)
print("b) Highest score in the class:", highest)
print(" Lowest score in the class:", lowest)
print("c) Count of students absent for the test:", absent_count)
print("d) Mark with the highest frequency:", freq_mark)