Question: Here is a function that which simulates the weather outcome, due to a forecast model and by using a random number ( see Module 1

Here is a function that which simulates the weather outcome, due to a forecast model and by using a random number(see Module 10.2 on random number generator):
from random import *
def sim_weather():
forecast = random() # generate a fractional number from 0 to 1, with even distribution
if forecast >0.85:
return "Sunny"
elif forecast >0.65:
return "Partly Cloudy"
elif forecast >0.25:
return "Showers"
else:
return "Thunder Showers"
If the program is run repetitively for a very larger number of times, say in thousands, list the forecast outcomes in the order of total occurrence of each from the highest to the lowest, .(Hint: youDon'thave to run the program to find the answer)

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 Programming Questions!