from itertools import chain, combinations
n = 3
print(list(chain.from_iterable(combinations(range(1, n + 1), i) for i in
    range(1, n + 1))))
Where's the error in this for loop to generate a list of ordered non-repeated combinations?