def split(inp,n):
    """
    Splits an input list into a list of lists.
    Length of each sub-list is n.
    :param inp:
    :param n:
    :return:
    """
    if len(inp) % n != 0:
        raise ValueError
    i = j = 0
    w = []
    w2 = []
    while i<len(inp):
        # print(i,j)
        if j==n:
            j = 0
            w2.append(w.copy())
            w = []
        w.append(inp[i])
        i += 1
        j += 1
    w2.append(w.copy())
    return w2