I want to write an if-statement for this list:
x = int(input())
y = int(input())
z = int(input())
n = int(input())
lst= ([[a, b, c] for a in range(0,x+1) for b in range(0,y+1) for c in range(0,z+1)])`
I want to add a, b and c in all lists and if they are not equal to n, print each of them. How should I do that?
you can use an if condition
in list comprehension , which makes this easy to achieve
lst= ([[a, b, c] for a in range(0,x+1) for b in range(0,y+1) for c in range(0,z+1) if a+b+c != n])