Skip to main content

List Comprehensions Hackerrank Solution in Python3

x=int(input())
y=int(input())
z=int(input())
n=int(input())
print("[",end="")
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:
if a==x and b==y and c==z:
print([a,b,c],end="")
else:
print([a,b,c],end=", ")
print("]")


Comments