Horje
Using Lists as Queues Code Example
Using Lists as Queues
>>> from collections import deque
>>> queue = deque(["Eric", "John", "Michael"])
>>> queue.append("Terry")           # Terry arrives
>>> queue.append("Graham")          # Graham arrives
>>> queue.popleft()                 # The first to arrive now leaves
'Eric'
>>> queue.popleft()                 # The second to arrive now leaves
'John'
>>> queue                           # Remaining queue in order of arrival
deque(['Michael', 'Terry', 'Graham'])




Python

Related
parsing a file and adding a number at starting of every line sentence python Code Example parsing a file and adding a number at starting of every line sentence python Code Example
django query column Code Example django query column Code Example
screen.blit() arguments Code Example screen.blit() arguments Code Example
python convert array to linked list Code Example python convert array to linked list Code Example
# list all keywords in Python Code Example # list all keywords in Python Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
7