q = [] 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("Customers waiting are:") print(q) # %% def add(name): """Customer with name 'name' joining the queue""" q.append(name) def next_ (): """Returns name of next customer to serve, removes customer from queue""" return q.pop(0) # main programme starts here add("Hawke") add("Fangohr") show() print("Length of queue is {}".format(length())) print("Next customer is {}".format(next_())) print("Next customer is {}".format(next_())) print("Length of queue is {}".format(length()))