Question: Prisoners simulation question: Q2. [9 pointsl Consider 1000 prisoners, each in a separate UNLOCKED cell. During the night, 10 officers visit the cells separately. When

Prisoners simulation question:

Prisoners simulation question: Q2. [9 pointsl Consider 1000 prisoners, each in a

Q2. [9 pointsl Consider 1000 prisoners, each in a separate UNLOCKED cell. During the night, 10 officers visit the cells separately. When an officer makes his/her round, the officer visits each cell with probability 0.4. Further, if a cell is visited by an officer, the door will be locked by the officer if it is unlocked. However, if the door of that cell is already locked, it will remain locked. If a prisoner's cell remains unlocked after all 10 officers have completed their rounds, the prisoner in that cell will escape. Define a function to return the number of prisoners escaped from the prison after the night. [Instruction: In this function, you can AT MOST have one loop/list comprehension.J Run this function 10000 times and report the average number of prisoners escaped The suggested solution version 1 (with one loop inside the function) has 9 lines of code. Version 2 (without loop inside the function) has 6 lines of code

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!