Let say I have :
student_tuples = [ ('john', 'A', 15),
('peter', 'B', 12),
('dave', 'C', 12)]
How do I sort it to be like this:
student_tuples = [('john', 'A', 15), ('dave', 'C', 12), ('peter', 'B', 12)]
What I can think is:
from operator import itemgetter
sorted(student_tuples, key=itemgetter(2,0), reverse=True)
but then the output will be:
student_tuples = [('john', 'A', 15), ('peter', 'B', 12), ('dave', 'C', 12)]
and that is not what I want. How can I do it using itemgetter or any other easier way?