嗨,我正在处理列表理解练习,但是我陷入了代码中,并遇到了上面提到的错误。 已经感谢您的帮助!
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)
答案 0 :(得分:0)
尝试一下:
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))