import heapq

li = [5, 7, 9, 1, 3]

# using heapify to convert list into heap
heapq.heapify(li)

# printing created heap
print ("The created heap is : ",end="")
print (list(li))


# using heappush() to push elements into heap
# pushes 4
heapq.heappush(li,4)


# printing modified heap
print ("The modified heap after push is : ",end="")
print (list(li))

# using heappop() to pop smallest element
print ("The popped and smallest element is : ",end="")
print (heapq.heappop(li))

import heapq

li = [5, 7, 9, 1, 3]

# using heapify to convert list into heap
heapq.heapify(li)

# printing created heap
print ("The created heap is : ",end="")
print (list(li))


# using heappush() to push elements into heap
# pushes 4
heapq.heappush(li,4)


# printing modified heap
print ("The modified heap after push is : ",end="")
print (list(li))

# using heappop() to pop smallest element
print ("The popped and smallest element is : ",end="")
print (heapq.heappop(li))

# using heapify to convert list into heap # printing created heap # using heappush() to push elements into heap # pushes 4 # printing modified heap # using heappop() to pop smallest element