You are viewing a single comment's thread. Return to all comments →
But instead of range[0,x] you could do
print ([[a,b,c] for a in range(x+1) for b in range(y+1) for c in range(z+1) if a + b + c != n ])
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.
really like this solution. simple and easy to read
i have done the same thing by its not working ,says invalid syntax
Simple and efficient than mine !! Thanks
will you please explain the program implementation program?
can you explain why a+b+c != n ?