We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I feel like I am missing the point of this exercise with my solution. Can someone please comment on how to make my code more pythonesque and utilize list comprehensions better.
X = int(raw_input())
Y = int(raw_input())
Z = int(raw_input())
N = int(raw_input())
Xi = [x for x in range(X+1)]
Yi = [y for y in range(Y+1)]
Zi = [z for z in range(Z+1)]
results = []
for x in Xi:
for y in Yi:
for z in Zi:
if x + y + z != N:
results.append([x,y,z])
print results
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
List Comprehensions
You are viewing a single comment's thread. Return to all comments →
I feel like I am missing the point of this exercise with my solution. Can someone please comment on how to make my code more pythonesque and utilize list comprehensions better.