-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path16collection_module.py
More file actions
22 lines (14 loc) · 870 Bytes
/
16collection_module.py
File metadata and controls
22 lines (14 loc) · 870 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#queue in python
#like we did include in c++, we import the module in python
#import module_name: This syntax imports the entire module named module_name. After importing, you can access the module's functions, classes, and variables using the module's name as a prefix.
#now to access specific modules function or class or variable we can directly import them using following syntax
#from module_name import function_name/class_name/variable_name
#to assign alias to those function_name/class_name/variable_name we can use following syntax
#from module_name import function_name as fn/class_name as cn/variable_name as vn
from collections import deque
my_queue=deque()
my_queue.append(1) #insetts at last
my_queue.appendleft(2) #inserts at first
my_queue.pop() #removes from last
my_queue.popleft() #removes from first
print(my_queue)