This is the problem I'm writing my code off of:
You are planning a picnic today, but the morning is cloudy
Oh no! 50% of all rainy days start off cloudy! But cloudy mornings are common (about 40% of days start cloudy) And this is usually a dry month (only 3 of 30 days tend to be rainy, or 10%) What is the chance of rain during the day?
We will use Rain to mean rain during the day, and Cloud to mean cloudy morning.
The chance of Rain given Cloud is written P(Rain|Cloud)
P(Rain) is Probability of Rain = 10%
P(Cloud|Rain) is Probability of Cloud, given that Rain happens = 50%
P(Cloud) is Probability of Cloud = 40%
*Answer should be 12.5% chance of rain. *
https://www.mathsisfun.com/data/bayes-theorem.html
probability = (0.1*0.5)/(0.4)
def p(probability):
return (probability)
print('Probability to rain is:', bayes(probability))