"""Supplied Python behavior for the Day-0 diagnostic.

Do not edit this file during the diagnostic.
"""


def score_percentage(earned_points: float, possible_points: float) -> float:
    """Return a percentage rounded to two decimal places."""
    if possible_points <= 0:
        raise ValueError("possible_points must be greater than zero")
    if earned_points < 0 or earned_points > possible_points:
        raise ValueError("earned_points must be within the available range")
    return round((earned_points / possible_points) * 100, 2)


def grade_band(percentage: float) -> str:
    """Return a conventional A-F band for a percentage in [0, 100]."""
    if percentage < 0 or percentage > 100:
        raise ValueError("percentage must be between 0 and 100")
    if percentage >= 90:
        return "A"
    if percentage >= 80:
        return "B"
    if percentage >= 70:
        return "C"
    if percentage >= 60:
        return "D"
    return "F"


def score_summary(scores: list[int]) -> tuple[int, int, float]:
    """Return minimum, maximum, and mean for synthetic scores."""
    if not scores:
        raise ValueError("scores must not be empty")

    minimum = scores[0]
    maximum = scores[0]
    total = 0

    for score in scores:
        if score < 0 or score > 100:
            raise ValueError("every score must be between 0 and 100")
        if score < minimum:
            minimum = score
        if score > maximum:
            maximum = score
        total += score

    return minimum, maximum, round(total / len(scores), 2)
