(data)
Convert data to floats and compute the arithmetic mean.

    This runs faster than the mean() function and it always returns a float.
    If the input dataset is empty, it raises a StatisticsError.

    >>> fmean([3.5, 4.0, 5.25])
    4.25
Convert data to floats and compute the arithmetic mean.
Convert data to floats and compute the arithmetic mean .
def fmean(data):
    """Convert data to floats and compute the arithmetic mean.

    This runs faster than the mean() function and it always returns a float.
    If the input dataset is empty, it raises a StatisticsError.

    >>> fmean([3.5, 4.0, 5.25])
    4.25
    """
    try:
        n = len(data)
    except TypeError:
        # Handle iterators that do not define __len__().
        n = 0
        def count(iterable):
            nonlocal n
            for n, x in enumerate(iterable, start=1):
                yield x
        total = fsum(count(data))
    else:
        total = fsum(data)
    try:
        return total / n
    except ZeroDivisionError:
        raise StatisticsError('fmean requires at least one data point') from None
def fmean ( data ) : try : n = len ( data ) except TypeError : # Handle iterators that do not define __len__(). n = 0 def count ( iterable ) : nonlocal n for n , x in enumerate ( iterable , start = 1 ) : yield x total = fsum ( count ( data ) ) else : total = fsum ( data ) try : return total / n except ZeroDivisionError : raise StatisticsError ( 'fmean requires at least one data point' ) from None