Question: (With Python) In this Python exercise, estimating the probability each port is attacked after 100 weeks.annotate code with short explaination. Suppose (as above) that each
(With Python) In this Python exercise, estimating the probability each port is attacked after 100 weeks.annotate code with short explaination. Suppose (as above) that each week the port most often attacked is recorded. The transition matrix for weekly attacks is P with initial distribution (as above).
(a) Simulate 100 weeks of attacks, and repeat the simulation 5,000 times. Compute the probability that each port is attacked after 100 weeks. Use the print function to print your answers. For example, print('The probability that Port %s is attacked after 100 weeks is %f.' % (nameOfPort, probOfPort))
(b) come with a bar graph to show the probability of attacks at each port after 100 weeks.
please answer #2 in python, thanks!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
