How to find the maximum and minimum elements of python
This article will explain in detail how to find the maximum and minimum elements of python. The editor thinks it is very practical, so I share it with you as a reference. I hope you can get something after reading this article.
Maximum-minimum element (heapq.nlargest and heapq.nsmallest)
> a = [random.randint (0100) for _ in xrange] > heapq.nsmallest (5, a) [3,3,5,6,8] > heapq.nlargest (5, a) [100,100,99,98,98] about how to find the maximum and minimum elements of python is shared here. I hope the above content can be helpful to you, so that you can learn more knowledge, if you think the article is good. Please share it for more people to see.