Oct-12-2016, 02:42 AM
The key function is passed each item of the sequence it is sorting.
In this case you are passing it the items() of a dict.
This is a sequence of (key, value) tuples like ('New York', 12).
So the argument t is one of these tuples and t[1] is the second element of the tuple.
IE you are sorting by the numbers and then reversing it.
Clear?
In this case you are passing it the items() of a dict.
This is a sequence of (key, value) tuples like ('New York', 12).
So the argument t is one of these tuples and t[1] is the second element of the tuple.
IE you are sorting by the numbers and then reversing it.
Clear?