hello everyone!
I wanted to create a priority queue in which there would be different dictionaries with their priority numbers. The major problem I'm experiencing is that the queue just prints the dictionaries without regard for their priority. Please what do I have to do so that the queue prints the different dictionaries based on their assigned priority numbers?
Thanks in advance!
Below is my python code:
from Queue import PriorityQueue
#making the priority queue object
pq = PriorityQueue()
#making the different dictionaries
firstDict = {'boy':'short', 'girl':'tall'}
secondDict = {'man':'tall', 'woman':'short'}
#putting the objects in the priorityQueue with a priority number
pq.put(firstDict, 1)
pq.put(secondDict,2)
#printing the dictionary according to their priority
#lower number means higher priority
while not pq.empty():
print pq.get()