Queue simulation

Hi, I’m currently working on my mini project to build a simulation of queue system in bank. The goals of this program is to be able to divide right amount of queue for each teller, so none teller has longer queue than other tellers.

Here is glimpse of my code:

queue_dict = {'Angel':[],
              'Mellysa':[],
              'David':[],
              'Thom':[],
              'Monica':[]
              }
queue_no = 0
while True:
    queue_no += 1

    customer_name = input("Enter your name: ")

    if customer_name == '':
        break

    #Find the teller that has lowest number of queue
    lowest_queue = np.inf
    for teller_name, customers_queue in queue_dict.items():
        if len(customers_queue)<lowest_queue:
            lowest_queue = len(customers_queue)
            chosen_teller = teller_name

    # Get the customer on the queue of the chosen teller
    queue_dict[chosen_teller].append(customer_name)

    print(f"{customer_name}, please go the teller {chosen_teller}")
    print()

My question is, from my code above, can someone help me If i want to create a code to select the very first and last customer?

You cannot, because you only keep the order by teller queue. If you want to have a global ordering, you have to keep it. Either as a “memory” of the arrival order(arrivals.append(customer_name), where arrivals is a list) or as a marker of the arrival order on the teller queue, queue_dict[chosen_teller].append((customer_name, arrival_no)), where you keep a counter for arrivals.

Thank you in advance for your hand on my case. But I still can’t figure it out where and how should I write my code in order to achieve my goal. Can you please help me with that?

How can I help you with that? You know how to create a list and append to it, so the first solution I proposed should not be a problem. On the list I called arrivals the first entry is the first customer to arrive and the last one the last customer to arrive.