def class_average(marks: list[float]) -> float:
    """Return class average marks."""
    if not marks:
        raise ValueError("Marks list cannot be empty")
    return sum(marks) / len(marks)


def topper(marks: list[float]) -> float:
    """Return highest mark."""
    if not marks:
        raise ValueError("Marks list cannot be empty")
    return max(marks)


def fail_count(marks: list[float], passing: float = 40) -> int:
    """Count number of students who failed."""
    return sum(1 for m in marks if m < passing)
