Search This Blog

Python - The average number of bouquets sold by a flower shop is 10 per day - Probability and Statistics -5 - HackerRank HandsOn Fresco Play

 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 the probability that exactly 15 bouquets will be sold tomorrow


Answer:

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
    
    probability=stats.poisson.pmf(1510
    ans = round(probability,2)
    return ans

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


Click on answer image:



No comments:

Post a Comment

If you have any doubts, Please let us know.