python data structures double-ended queueor dequesupports adding and removing elements from either end the more commonly used stacks and queues are degenerate forms of dequeswhere the inputs and outputs are restricted to single end import collections doubleended collections deque(["mon","tue","wed"]doubleended append("thu"print ("appended at right "print (doubleendeddoubleended appendleft("sun"print ("appended at right at left is "print (doubleendeddoubleended pop(print ("deleting from right "print (doubleendeddoubleended popleft(print ("deleting from left "print (doubleendedappended at right deque(['mon''tue''wed''thu']appended at right at left is deque(['sun''mon''tue''wed''thu']deleting from right deque(['sun''mon''tue''wed']