Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Python function to run a Parking Lot (PL) simulation, called PLSimulation, which takes four integers as parameters. The first parameter is the minimum

Write a Python function to run a Parking Lot (PL) simulation, called PLSimulation, which takes four integers as parameters. The first parameter is the minimum number of cars that can park in the PL during one hour; the second parameter is the maximum that can park during one hour. The third parameter is the maximum number of cars that may leave the PL during one hour. The fourth parameter is the number of hours to run the simulation.

Your function should simulate parking and leaving cars for the specified number of hours. In each hour, the following occurs in this order:

1. A random number of cars arrive, ready to park (between the minimum and maximum). That number is added to a count of the number waiting to park.

2. The maximum number of cars that may leave, allowing the same number of cars to park, so that number is subtracted from the count of the number waiting to park (if there are that many waiting to park).

Initially, the number of cars waiting to park is 0. To generate a random number of cars each hour, use the randrange function, which takes two integer parameters, and which must be imported from the random module. After the simulation is over, write a report giving the car arrival rate (between the minimum and maximum), the car departure rate, and the number of cars waiting to park after the simulation has run for the specified number of hours.

Please provide full Python function.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Learn To Program Databases With Visual Basic 6

Authors: John Smiley

1st Edition

1902745035, 978-1902745039

More Books

Students also viewed these Databases questions

Question

Distinguish between filtering and interpreting. (Objective 2)

Answered: 1 week ago