print("\ \npopping left"print("popping { }format(mydeque popleft())for item in mydequeprint(itemend="print("\ \ \ \nremoving"mydeque remove(" "for item in mydequeprint(itemend="the implementation of deque is found in the collections moduleso you need to import it into your code when you create dequeyou can optionally specify starting list of iterable items (items that can be accessed and processed as part of loop structureand maximum sizeas shown deque differentiates between adding one item and adding group of items you use append(or appendleft(when adding single item the extend(and extendleft(functions let you add multiple items you use the pop(or popleft(functions to remove one item at time the act of popping values returns the value poppedso the example prints the value onscreen the remove(function is unique in that it always works from the left side and always removes the first instance of the requested data unlike some other collectionsa deque is fully iterable this means that you can obtain list of items using for loop whenever necessary choose runrun module you see python shell window open the example outputs the information shown in figure - it' important to follow the output listing closely notice how the size of the deque changes over time after the application pops the jthe deque still contains eight items when the application appends and extends from the leftit adds three more items howeverthe resulting deque contains only ten items when you exceed the maximum size of dequethe extra data simply falls off the other end