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.
List Comprehensions
List Comprehensions
Sort by
recency
|
1838 Discussions
|
Please Login in order to post a comment
seems the answer to the question is wrong even though it passed the test cases. the question askes to sort the result in ascendign order, which implies, at least to me, that the resulting list should be sorted in increasing order of the sum of its sub lists. when the list is sorted, the answer fails some test cases.
if name == 'main': x = int(input()) y = int(input()) z = int(input()) n = int(input())
not_sum = [[i,j,k] for i in range(x+1) for j in range(y+1) for k in range(z+1) if i+j+k != n]
print(not_sum)
For Python3 Platform