If you want to use the min() or max() function in python. There is that an alternative way of the speedy method is headq.
The time complexity for finding a max value and a min value is O(logn).
Time complexity of min() and max() are O(n).
import heapq
h = []
heapq.heappush(h, (0, 10))
heapq.heappush(h, (4, 5))
heapq.heappush(h, (3, 2))
heapq.heappush(h, (3, 5))
heapq.heappush(h, (1, 5))
heapq.heappop(h)
# >>> (0, 10)
# You could change to max heap and get maximum number from it.
heapq._heapify_max(h)
heapq.heappop(h)
# >>> (4, 5)