Question
1.47 You and two friends drive separately to the movies. The movie parking lot has 20 spaces, all in a row. If 15 spaces are
1.47 You and two friends drive separately to the movies. The movie parking lot has 20 spaces, all in a row. If 15 spaces are occupied at random, what is the probability that you and your two friends can find adjacent parking spots? In other words, what is the probability that there are at least 3 adjacent empty spaces? Can you verify your answer via Monte Carlo simulation? Can you generalize this to n spots with m occupied and searching for k in a row?
ANSWER PART A ONLY IN PYTHON
Simulate problem 1.47 (parking lot problem). Specifically, consider a parking lot with:
Nspots = the total number of parking spots
Nempty = total number of empty spots
Nsought = number of contiguous empty spots sought
(a) Write a program/script IN PYTHON to estimate the probability of finding a run of Nsought empty spots. Run your program for several cases, including the case of 1.47 and
Nspots = 30
Nempty = 9
Nsought = 4
Step 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