items =[
("product1",10),
("product2", 2),
("product3", 5)
]
def value(item): #the function return only the numbers
return item[1]
items.sort(key=value) #don't call the function but passing it
print(items)
#OR by using Lamda Function
items.sort(key= lambda item: item[1])
# Output >>> [('product2', 2), ('product3', 5), ('product1', 10)]