📅  最后修改于: 2022-03-11 14:47:15.358000             🧑  作者: Mango
# lists_of_tuples = [('item', 'price'), ('item', 'price'), ('item', 'price')]
def sort_prices(list_of_tuples): #sort the list b*y the price of each tuple
list_of_tuples.sort(key=lambda x: x[1], reverse=True) #earse the "reverse" part to sort in small to big.
return list_of_tuples, print(list_of_tuples)