-
-
Save IndhumathyChelliah/e4845dc5473ba654c70ed12891dfcab9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from collections import deque | |
queue=deque([1,2,3]) | |
#adds elements to the end of list | |
queue.append(4) | |
print (queue)#Output:deque([1, 2, 3, 4]) | |
queue.append(5) | |
print (queue)#Output:deque([1, 2, 3, 4, 5]) | |
#retrieves element from begining of list. (first in first out.) | |
print (queue.popleft())#Output:1 | |
print (queue)#Output:deque([2, 3, 4, 5]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment