def mean(qualities):
    """Calculates the average of a list which might be empty.

    Parameters
    ----------
    qualtiies : list
        list of numbers

    Returns
    -------
    float
        Float representing the mean numbers in the the list; zero if the list is empty.
    """
    if len(qualities) == 0:
        return 0
    de_phred = []
    for x in qualities:
        de_phred.append(100 - 100 * 10 ** (-1.0 * x / 10.0))
    return sum(de_phred) / float(len(de_phred))
