+ 1
How the python interpreter thinks for the folllowing code?
https://www.hackerrank.com/challenges/list-comprehensions/problem x, y , z, n = int(input()), int(input()), int(input()), int(input()) print([[a,b,c] for a in range (x+1) for b in range(y+1) for c in range(z+1) if a +b+c != n])
2 Respostas
+ 6
[[a,b,c] for a in range (x+1) for b in range(y+1) for c in range(z+1) if a +b+c != n] is same as
for i in range(x+1):
for j in range(y+1):
for k in range(z+1):
if i+j+k != n:
myList.append([i,j,k])
considering myList as the list containing lists of [a,b,c].