You are viewing a single comment's thread. Return to all comments →
I'm getting correct answer in other compiler but not here
from itertools import permutations,product
if name == 'main': x = int(input()) y = int(input()) z = int(input()) n = int(input())
num= list(range(0,max(x,y,z)+1)) numbers=list(product(num,repeat=3)) final_no=[list(x) for x in numbers if sum(x)!=n ] print(final_no)
print(final_no)
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
List Comprehensions
You are viewing a single comment's thread. Return to all comments →
I'm getting correct answer in other compiler but not here
from itertools import permutations,product
if name == 'main': x = int(input()) y = int(input()) z = int(input()) n = int(input())
num= list(range(0,max(x,y,z)+1)) numbers=list(product(num,repeat=3)) final_no=[list(x) for x in numbers if sum(x)!=n ] print(final_no)
print(final_no)