You are viewing a single comment's thread. Return to all comments →
That's really great :)
print ([[a,b,c] for a in range(int(input())+1) for b in range(int(input())+1) for c in range(int(input())+1) if a+b+c!=int(input())])
why does this code not work?
can you explain?
The inputs should be captured before the for loop is executed. In this case, a new input is expected for every iteration of the for loop. Try capturing the inputs first inside some variables and use those variables here. That will work.