Question: Python - help! What is wrong with my main block? am I misunderstanding the instructions? or what am I missing? Main Block This block will

Python - help! What is wrong with my main block? am I misunderstanding the instructions? or what am I missing?

Python - help! What is wrong with my main block? am Imisunderstanding the instructions? or what am I missing? Main Block This blockwill use the standard check for _name__ and represents the entry point

Main Block This block will use the standard check for _name__ and represents the entry point for the program: if name _main_": In this block, create the printlock Lock object which will be passed to all of the thread functions and used by bankprint(): printlock = Lock() Next, create a Queue called teller_line which represents the line customers get into waiting for a teller (the maxsize parameter need to be set to the max_customers_in_bank value): teller_line - Queue (maxsize=max_customers_in_bank) Now, you need a Semaphore object that represents a security guard. A semaphore only allows a limited number of threads to acquire a resource at the same time, just as a security guard limits the number of customers allowed in the bank at once. Like the queue, this object will also be limited to max_customers_in_bank semaphore resources: guard = Semaphore (max_customers_in_bank) Finally after the guard is created, print several messages to the terminal by using the bankprint() method: bankprint(printlock, " Security guard starting their shift") bankprint (printlock, "*B* Bank open") Notice that the printlock argument is passed to bankprint(). Also, each message is preceded with a tag of sorts. This will help distinguish output in what will be a very busy terminal/shell. For this code, use the following prefixes: *B* for bank messages for security guard messages [T] for teller messages (C) for customer messages . 43 if == name printlock _main__ Lock() 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 teller_line = Queue (maxsize=max_customers_in_bank) guard = Semaphore(max_customers_in_bank) bankprint(printlock, " Security guard starting their shift") bankprint(printlock, "*B* Bank open") *B* for bank messages for security guard messages [T] for teller messages (C) for customer messages

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!