hacker rank python problem(list comprehension)solution

LIST COMPREHENSIONS

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

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

Compiler Message
Success
Input (stdin)Download
1
1
1
2
Expected OutputDownload
[[0, 0, 0], [0, 0, 1], [0, 1, 0], [1, 0, 0], [1, 1, 1]]
         
        

Comments

Popular posts from this blog

Amazon Web Services

Google Code-In mentorship experience :)

Hacker Rank all java and python problem solutions