from barber import Barber from customer import Customer from threading import Thread from time import sleep def run(barber: Barber, file: str): customer_arrival_times = [int(t.strip()) for t in open(file, 'r').readlines()] for i, time in enumerate(customer_arrival_times): customer = Customer(chr(65 + i), time) barber.add_customer(customer) if i < len(customer_arrival_times) - 1: sleep(customer_arrival_times[i + 1] - time) if __name__ == '__main__': barber = Barber("Billu") thread = Thread(target=run, args=(barber, 'input.txt')) thread.start() thread.join()