def get_lists_with_sum(length, my_sum):
    if my_sum == 0:
        return [[(0) for _ in range(length)]]
if not length:
    return [[]]
elif length == 1:
    return [[my_sum]]
else:
    lists = []
for i in range(my_sum + 1):
    rest = my_sum - i
sublists = get_lists_with_sum(length - 1, rest)
for sl in sublists:
    sl.insert(0, i)
lists.append(sl)
return lists
print(get_lists_with_sum(11, 8))
Creating an array of numbers that sum to a given number