>>> def heapsort(iterable):
... h = []
... for value in iterable:
... heappush(h, value)
... # default its min heap
... print("Smallest element", h[0])
... return [heappop(h) for i in range(len(h))]
...
>>> heapsort([1, 3, 5, 7, 9, 2, 4, 6, 8, 0])
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]