def centroid2d(points):
    """
    Calculate the centroid of a finite set of 2D points.

    :param points: the set of points as an iterable. Each point is assumed to
        be a sequence of (at least) two real numbers ``[x, y]``, respectively
        the x (first element) and y coordinate (second element).
    :return: the centroid or ``None`` if the input is empty.
    :raise IndexError: if any point is an empty list.
    :raise TypeError: if the input is ``None`` or a point has a ``None`` coord
        or the coord isn't a number.
    """
    number_of_points = 0
    centroid = [0, 0]

    for p in points:
        centroid = (centroid[0] + p[0], centroid[1] + p[1])
        number_of_points += 1

    centroid = [centroid[0]/number_of_points, centroid[1]/number_of_points] \
        if number_of_points else None

    return centroid