Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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:
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 codeStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started