Question: In Python please A car rental company has two locations, Portland and Salem. Some customers do one- way rentals, picking up a car in Portland

In Python please

In Python please A car rental company has two locations, Portland and

A car rental company has two locations, Portland and Salem. Some customers do "one- way rentals," picking up a car in Portland and returning it in Salem, or the other way around. Each week 5% of the cars in Portland are dropped off in Salem, and 3% of the cars in Salem get dropped off in Portland. At the beginning of the year, there are 150 cars at each location. Write a program that plots the number of cars in Portland and Salem each week for 1 year (52 weeks) to find if the number of cars eventually stays the same. Mark both cities on the same plot with different symbols or colors. Hints: Create arrays Portland and Salem to contain the 52 values using the zeros function. First write the lines of code that update the number of cars in each location from one week to the next. Initialize the variables Portland and Salem with the number of cars in each location at the beginning of the week. Calculate the number of cars moving Portland-> Salem and Salem ->Portland. Then compute the next values for the arrays Portland and Salem. Put this in a loop to repeat for 52 weeks Add commands to plot the number of cars at each week using the pyplot package https://matplotlib.org/tutorials/introductory/pyplot.html Note: cars are countable things, so a and b should always be integer values. You can use the rint (Links to an external site.) function to round off the number of cars that move during each week. (Type "help round") You can start your program like this: from numpy import zeros, rint from matplotlib.pyplot import figure, plot, show import matplotlib.pyplot as plt nweek=52 Portland = zeros(nweek) Salem = zeros(nweek)

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!