python - Difficulty with writing a merge function with conditions -


im trying write function cant right. supposed merge function merges follows: function recieves input list of lists(m lists, ints). function creates list contains indexes of minimun values in each list of input(each list of list of lists, overall m indexes). example: lst_of_lsts= [[3,4,5],[2,0,7]] min_lst= [0,1]

at each stage, function chooses minimum value list , adds new list called merged. then, erases list of indexes(min_lst) , adds next index new minimum. @ end returns merged organized list small ints big ints. example: merged= [0,2,3,4,5,7]

another thing im not allowed change original input.

def min_index(lst):     return min(range(len(lst)), key=lambda n: lst[n])  def min_lists(lstlst):     return [min_index(lst) lst in lstlst] 

then

min_lists([[3,4,5],[2,0,7]])   # => [0, 1] 

edit:

this site doesn't exist solve homework you. if work @ , solution doesn't expect, show you've done , we'll try point out mistake.

i figure solution ok because it's correct, in such way teacher never believe wrote it; if can understand solution should solve yourself, , along way teach python-fu.


Comments

Popular posts from this blog

PHPMotion implementation - URL based videos (Hosted on separate location) -

javascript - Using Windows Media Player as video fallback for video tag -

c# - Unity IoC Lifetime per HttpRequest for UserStore -