# Queue.py
# Mechanical MOOC MIT OCW 6.189 Exercise 3.6
# List implementation of a Queue
# Glenn A. Richard
# August 2, 2013
class Queue(object):
    def __init__(self):
        # Initialize the Queue to empty
        self.items = []
    def insert(self, item):
        # Append the item to the back of the Queue
        self.items.append(item)
    def remove(self):
        if len(self.items) == 0:
            # The Queue had no items in it
            return "The Queue is empty"
        else:
            # The Queue was not empty; remove and return the item at the front
            return self.items.pop(0)

queue = Queue()
queue.insert(5)
queue.insert(6)
print queue.remove()
# 5
queue.insert(7)
print queue.remove()
# 6
print queue.remove()
# 7
print queue.remove()
# The queue is empty
