Hands On - Probability and Statistics -5 - Non-mutually Exclusive Events

Rumman Ansari   Software Engineer   2023-02-23   342 Share
☰ Table of Contents

Table of Content:


Hands On - Probability and Statistics -5 - Non-mutually Exclusive Events

Problem Statement
The average number of bouquets sold by a flower shop is 10 per day. What is the probability that
exactly 15 bouquets will be sold tomorrow? Use Poisson Distribution.
Write a function that returns the probability
Round off the Probability to 2 decimal places

Function Description
Function Name: poisson()
    1. Output:
ans : Float: Denoting t he probability that exactly 15 bouquets will be sold tomorrow


from scipy import stats


def poisson():
    '''
    output: ans : Float
    '''
    #Write your code here
    #Assign the probability value to the variable ans
    #Round off to 2 decimal places

    lam = 10  # average number of bouquets sold per day
    k = 15    # number of bouquets sold tomorrow
    ans = stats.poisson.pmf(k, lam)  # probability mass function of Poisson distribution
    ans = round(ans, 2)  # round off to 2 decimal places
    return ans

if __name__=='__main__':
	print(poisson())

Output:


0.03