import math


def mean(x):
    """Mean.

    Args:
        x (list): float (int) list

    Returns:
        float: Mean value of x.

    Raises:
        ValueError: when x is empty

    Examples:
        >>> mean([1, 2, 3, 4, 5])
        3.0

        >>> mean([])
        Traceback (most recent call last):
        ...
        ValueError: An empty data list has no mean []

        >>> mean(42)
        Traceback (most recent call last):
        ...
        TypeError: object of type 'int' has no len()
    """
    if len(x) < 1:
        raise ValueError("An empty data list has no mean {x}".format(x=x))
    return math.fsum(x) / len(x)