DEV Community

Afiz
Afiz

Posted on

How to find nth largest/smallest item from a List in Python

Do you know you can find n largest/smallest items from a list using heapq python standard library?

Check out this example below:

Image description

If you like this content consider following me.

Discussion (0)