# We use the built-in Python deque data structure for queues.
# Deque is implemented using linked lists and more efficient
# than Python lists for popping the left-most element.
from collections import deque
Define a Queue class that supports the methods
1) .enqueue(element): Add element to back of queue
2) .dequeue(): Return element from front of queue
3) .size(): Return number of elements in queue
# self is a reference to the instance that was just created
# Return optional representation of class in string format
def enqueue(self, element):
print(f"{element} joins the queue")
self.data.append(element)
element = self.data.popleft()
print(f"{element} leaves the queue")
print(f"Queue contains {len(self.data)} elements")