def a(L, w):
    w.add(sum(L))
    for e in L:
        K = L[:]
        K.remove(e)
        a(K, w)
    return w


wynik = set()
L = [1, 2, 3, 100]
print(sorted(a(L, wynik)))

44181fc1d80f5a5b3aad4e8f353e24197bbc4e29
<mask token>

def a(L, w):
    w.add(sum(L))
    for e in L:
        K = L[:]
        K.remove(e)
        a(K, w)
    return w


<mask token>

def a(L, w):
    w.add(sum(L))
    for e in L:
        K = L[:]
        K.remove(e)
        a(K, w)
    return w


<mask token>
print(sorted(a(L, wynik)))

def a(L, w):
    w.add(sum(L))
    for e in L:
        K = L[:]
        K.remove(e)
        a(K, w)
    return w


wynik = set()
L = [1, 2, 3, 100]
print(sorted(a(L, wynik)))
