Why do you calculate the index of the minimum value of a list to calculate three times?
harrylyx opened this issue · comments
#Function to sort by values
def sort_by_values(list1, values):
sorted_list = []
while(len(sorted_list)!=len(list1)):
if index_of(min(values),values) in list1:
sorted_list.append(index_of(min(values),values))
values[index_of(min(values),values)] = math.inf
return sorted_list
Why do you calculate the index of the minimum value of a list to calculate three times?
And does this function not generate a return value the same as list1?
I am wondering the same, plus why is there a function for index_of when we already have list.index()?