Why can't I sort this list?

list, python, tuples

Solution

The `sorted` function returns a new list so you will need to assign the results of the function like this:

new_list = sorted(statlist, key=lambda x: int(x[1])) 

Problem

``` statlist = [('abc',5,1), ('bzs',66,1), ... ] sorted(statlist, key=lambda x: int(x[1])) ``` I want to sort it by the integer largest to smallest. In this case, 5 and 66. But it doesn't seem to be working.

Original source

Related problems