- On new Year's Eve, the probability of a person having a car accident 0.09. The probability of a person driving while intoxicated is 0.32 and the probability of a person having a car accident while intoxicated is .15.
- What is the probability of a person driving while intoxicated or having a car accident?
- Probabilities:
- P(accident)=0.09
- P(intoxicated)=0.32
- P(accident and intoxicated)=0.15
Note:
- Return the probability in decimal rounded off to 2 decimal places
- Hint: Use Addition rule and Non-Mutually Exclusive
Function Description
Function Name: accident()
- Output:
- ans: Float - Denoting probability of a person driving while intoxicated or having a car accident?
Answer:
from scipy import stats
def accident():
'''
output: ans : Float
'''
#Write your code here
#Assign the probability value to the variable ans. Round off to 2 decimal places
accident = 0.09
intoxicated = 0.32
ai = 0.15
prob =(accident+intoxicated)-ai
ans=round(prob,2)
return ans
if __name__=='__main__':
Click on the tested image:
No comments:
Post a Comment
If you have any doubts, Please let us know.