q = [] # n = 0 # number of people in the queue def length(): """Returns number of waiting customers""" return len(q) def show(): """SHOW queue: print list of waiting customers. Customer waiting longest are shown at the end of the list.""" print(list(reversed(q))) def add(name): """Customer with name 'name' joining the queue""" # could check that name is a string q.append(name) def next(): """Returns name of next customer to serve, removes customer from queue""" if len(q) == 0: print("The queue is empty.") else: return q.pop(0)