You are viewing a single comment's thread. Return to all comments →
Trade three +1's for a +1 and a -1 at the right place :P
x, y, z, n = (int(raw_input())+1 for _ in range(4))
print [[a,b,c] for a in range(x) for b in range(y) for c in range(z) if a+b+c!=n-1]
although this method is more simple, but it not easy to understand.
I liked this method compared to other's.