I have a list of all countries in the world with its population e.g.
Countries = [("argentina", 124854), ("brazil",568854)]
The first value is a string=country the second is integer = population
The task is sort the list by it second value by using reverse true when sorted, I have managed to do it by the string first value country in analphabetic order ASC and DESC but I don't know how to write the code to sort by population in from the largest to smallest population?
pop lambda country:country[1]
countries.sort(key=pop, reverse=True)
Countries
This code doesn't work as expected.