...# Replace the smallest element in the heap with a new element
heapq.heapreplace(nums, 6)
# Print the smallest element in the heap one last time
print(heapq.heappop(nums))
```
Output:
```
1
5
6
3
```
### Hashtags
* #Python
* #Heapq
* #data-structures
* #Trees
* #algorithms