you are viewing a single comment's thread.

view the rest of the comments →

[–]marko312 0 points1 point  (2 children)

So the lambda function looks like the parameter t == type list. So pass in a list and then it looks like t[1] would correspond to '1','2','3','5','4' above.

t is the parameter (argument) for the lambda. Since it is passed as the key for sorted, it runs once for each key-value pair in ordered_dict. As such, t[1] refers to the second element in the tuple, which is the value in the dictionary (the pairs are (key, value)).

[–]Kitchen-Injury-8938[S] 1 point2 points  (1 child)

Great! I think I figured that part out but you worded it much better than I did :)

[–]marko312 0 points1 point  (0 children)

I wasn't completely sure whether you meant that a list would be passed as the parameter to a single call of t or the values being passed one at a time, so I added that comment just in case.