I have a list, which is appended with integer and float values. I want to sort that list based on the integer value to get min and max values of the floats:
my_list = [['first', -20, 'second', 4.6429111469868918],
['first', -19, 'second', 4.6478324005489107],
['first', -18, 'second', 4.652294108548074],
['first', -17, 'second', 4.6562933144428431]]
min_int = my_list.sort(key=lambda x:x[1],reverse=True)
max_int = my_list.sort(key=lambda x:x[1],reverse=False)
print("min_int: ", min_int)
print("max_int: ", max_int)
The sort with the key results:
min_int: None
max_int: None
I don't understand the reason of that. Could someone can help?