So I have a list that looks something like this:
example = [['b',1],['b',2],['a',2]]
And it needs to be sorted to become:
example = [['b',1],['a',2],['b',2]]
I.e. sorted numerically by the number in the [1] position. The program needs to recognise when there are two numbers that are the same, and then sort these elements alphabetically.
Any ideas?
Edit:
and how would I go about sorting the list so that the highest number is printed first?, i.e:
example = [['a',2],['b',2],['b',1]]