how to print the name first

12 views
Skip to first unread message

truerenwang

unread,
Sep 23, 2014, 2:45:21 PM9/23/14
to psychology-...@googlegroups.com
Hi everyone,
I have a question about today's class. At very last, we talked about printing the "grade" and "name" sorted from low score to high score.
The codes are as below

scores = {'Jibo':100,'Python':99,'Drop Table':59}
sorted([(grade,name) for name,grade in scores.items()])

My question is how to print the 'name' first and then ' grade', but still keep the order from low score to high score?

i.e. how to print like this:

Drop Table 59
Python 99
Jibo 100
Reply all
Reply to author
Forward
0 new messages