Using Lists as Queues : Queue : Data Structure PYTHON examples


PYTHON examples » Data Structure » Queue »

 

Using Lists as Queues


Using Lists as Queues


# To add an item to the back of the queue, use append(). To retrieve an item 
from the front of the queue, use pop() with as the index. For example:

queue = ["A""B""C"]
queue.append("D")          
queue.append("E")          
print queue.pop(0)

print queue.pop(0)

print queue

           
       



    Related Scripts with Example Source Code in same category :

Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON examples

 Navioo Data Structure
» Queue