What is the Python code for implementing a priority queue?
A priority queue is a data structure that stores and retrieves elements based on their priority, which is usually a numerical value or a comparison function. Priority queues are useful for applications that need to process items in a certain order, such as scheduling tasks, routing packets, or finding the shortest path. In this article, you will learn how to implement a priority queue in Python using two different approaches: a list and a heap.