<reponame>DinulDassanayake/Data-structures

import collections
  
# initializing deque
de = collections.deque([1,2,3])
  

de.append(4)
  

print ("The deque after appending at right is : ")
print (de)
  

de.appendleft(6)
  

print ("The deque after appending at left is : ")
print (de)
  

de.pop()
  

print ("The deque after deleting from right is : ")
print (de)
  

de.popleft()
  

print ("The deque after deleting from left is : ")
print (de)


#Output
#The deque after appending at right is : 
#deque([1, 2, 3, 4])
#The deque after appending at left is : 
#deque([6, 1, 2, 3, 4])
#The deque after deleting from right is : 
#deque([6, 1, 2, 3])
#The deque after deleting from left is : 
#deque([1, 2, 3])

import collections
  
# initializing deque
de = collections.deque([1,2,3])
  

de.append(4)
  

print ("The deque after appending at right is : ")
print (de)
  

de.appendleft(6)
  

print ("The deque after appending at left is : ")
print (de)
  

de.pop()
  

print ("The deque after deleting from right is : ")
print (de)
  

de.popleft()
  

print ("The deque after deleting from left is : ")
print (de)


#Output
#The deque after appending at right is : 
#deque([1, 2, 3, 4])
#The deque after appending at left is : 
#deque([6, 1, 2, 3, 4])
#The deque after deleting from right is : 
#deque([6, 1, 2, 3])
#The deque after deleting from left is : 
#deque([1, 2, 3])
# initializing deque #Output #The deque after appending at right is : #deque([1, 2, 3, 4]) #The deque after appending at left is : #deque([6, 1, 2, 3, 4]) #The deque after deleting from right is : #deque([6, 1, 2, 3]) #The deque after deleting from left is : #deque([1, 2, 3])