from typing import Optional


def average(seq: list[Optional[float]]) -> float:
    """Average of non-None values"""
    total, count = 0.0, 0
    for v in filter(None, seq):
        total += v
        count += 1
    return total / count