When we input x = 1, y = 1, z = 1 and n = 2, there's one result that shouldn't be printed but it doesn't happen.
[[0, 0, 0], [0, 0, 1], [0, 1, 0], [1, 0, 0], [1, 1, 0], [1, 1, 1]] <- last result
x = int(input())
y = int(input())
z = int(input())
n = int(input())
list1 = [ 
    [i,j,k] 
    for i in range(x+1)
    for j in range(y+1)
    for k in range(z+1)
]
list1.sort()
print(list1)
for subList in list1:
    if sum(subList) == n:
        list1.remove(subList)
it shouldn't print the sublist = [1,1,0], the sum is 2, despite my command:  if sum(subList) == n:
What should I do?
 
    