from typing import Counter


def mode(x):
    """
    Mode of X.

    :param list or tuple x: array to calculate mode.
    :return: list of modes.
    :rtype: list
    :raise ValueError: when len of x == 0.
    """
    if x:
        counts = Counter(x)
        max_val = max(counts.values())
        return [k for k, counts in counts.items() if counts == max_val]
    else:
        raise ValueError('len of x == 0')