def filter_days_avg(y: list[float], n: int) -> list[float]:
    """
    Filter y by taking an average over an n-days window. If n = 0, then return y without processing.

    Preconditions:
        - n % 2 == 1
        - len(y) > 0

    >>> actual = filter_days_avg(list(range(10)), 3)
    >>> expected = [1/3, 1, 2, 3, 4, 5, 6, 7, 8, 26/3]
    >>> all(math.isclose(actual[i], expected[i]) for i in range(10))
    True

    >>> actual = filter_days_avg(list(range(10)), 5)
    >>> expected = [0.6, 1.2, 2, 3, 4, 5, 6, 7, 7.8, 8.4]
    >>> all(math.isclose(actual[i], expected[i]) for i in range(10))
    True

    :param y: Values
    :param n: Number of days, must be odd
    :return: Averaged data
    """
    if n <= 1:
        return y
    if n % 2 != 1:
        ValueError(f'n must be odd (you entered {n})')

    # Sliding window; maintain a sum of an interval centered around i
    # if the interval exceeds the beginning/end, pretend that the first/last elements are "extended"

    radius = n // 2
    current_sum = (radius + 1) * y[0]  # current sum is sum(y[-r:0] + y[0:1] + y[1:r + 1])
    for i in range(radius):
        i = min(i, len(y) - 1)
        current_sum += y[i]  # adding the values in y[1:r + 1]

    ret = []
    # python_ta says "unnecessary indexing" because the index only accesses items from 1 list.
    # But a look at the code tells you that iterating is not sufficient for the sliding window,
    # random access is actually better, because prior elements need to be accessed as well, and
    # using a queue seems too silly. The other option is to literally extend the array but that
    # takes extra space instead of O(1) space, so why do that?
    for i in range(len(y)):
        left, right = i - radius, i + radius
        left = max(0, left)  # avoid index out of bounds by "extending" first/last element
        right = min(right, len(y) - 1)
        current_sum += y[right]  # extend sliding window
        ret.append(current_sum / n)
        current_sum -= y[left]  # remove old values
    return ret