python how to sort a list depending on key value code example
Example 1: sorted python lambda
lst = [('candy','30','100'), ('apple','10','200'), ('baby','20','300')]
lst.sort(key=lambda x:x[1])
print(lst)
Example 2: sort list of dictionaries python by value
newlist = sorted(list_to_be_sorted, key=lambda k: k['name'])