1

Hi I'm dealing with the list comprehension exercises but I got stuck in a code, and getting the error mentioned above. Already appreciate for the help!

x = int(input())
y = int(input())
z = int(input())
n = int(input())

print([i,j,k] for i in range(x+1) for j in range(y+1) for k in range(z+1) if not (i+j+k) == n)

1 Answers1

0

Try this:

x = int(input())
y = int(input())
z = int(input())
n = int(input())

print(tuple([i,j,k] for i in range(x+1) for j in range(y+1) for k in range(z+1) if not (i+j+k) == n))
Cao Minh Vu
  • 1,900
  • 1
  • 16
  • 21