import random import matplotlib.pyplot as plt import numpy as np """ You’ve created two normal distributions centered on 15 and 45 minutes past the hour and summed them. You set the most likely arrival time to a value of 1 by dividing by the maximum value. You can now simulate bus arrival times using this distribution. To do this, you can create random times and random relative probabilities using the built-in random module. In the code below, you will also use list comprehensions: You’ve simulated 40 bus arrivals, which you can visualize with the following scatter plot: """ n_buses = 40 bus_times = np.asarray([random.randint(0, 59) for _ in range(n_buses)]) bus_likelihood = np.asarray([random.random() for _ in range(n_buses)]) plt.scatter(x=bus_times, y=bus_likelihood) plt.title("Randomly chosen bus arrival times and relative probabilities") plt.ylabel("Relative probability of bus arrivals") plt.xlabel("Minutes past the hour") plt.show()