0
Calculating the index of an sub list acc to sum of all int elements of a list in Python
For a particular ques I have tried using different funcs to pop a sublist whose sum of all int elements of the sublist is not equal to n , hereâs what I have tried using so far : What Iâm getting stuck on is what logic to use to defence to the sublist with the wrong sum. Doesnât work Help Code: from itertools import product x= int(input()) y= int(input()) z= int(input()) n= int(input()) lis= [x,y,z] prodman= list(product(list,list,list)) p_list= list(map(list,prodman) def funcman(): for p_maine in p_list: if (sum(p_maine) != n): ??????????????????????? else: continue print(p_list)
2 Answers
+ 4
Toy , to get a better understanding of your problem, it would be great getting 1 or 2 input samples and the resulting output from you. Thanks in advance!
+ 1
product(list,list,list) what is it?
list is the built-in function to convert something to list object. And I cant figure out what did you try to do
if I got you correct this code could help you:
https://code.sololearn.com/cSW9CEktFlLV/?ref=app