I am trying to sot the following 'tupled' list from smallest to largest:
tuple1
:
[('Bread', 3.1), ('Cheese', 8.2), ('Milk', 6.1), ('Pasta', 4.5) ...
I like to sort the tuple by integers, in ascending order - I have attempted the following:
>>> sortedTuple = tuple1.sort(key=lambda x: (x[0],int(x[1]))
However, I receive the following output:
None
My expected output would be:
[('Bread', 3.1), ('Pasta', 4.5), ('Milk', 6.1), ('Cheese', 8.2)...