Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

taking a function that uses the definition of mugpurchase(chance):flag =np.random.ran() Write a function calculateProb that determines the probability of you buying your friend the tea

taking a function that uses the definition of mugpurchase(chance):flag =np.random.ran()

image text in transcribed
Write a function calculateProb that determines the probability of you buying your friend the tea collection as a gift. Use the mugPurchase function created in Part 1. Return the probability of you buy the tea collection. Your function should: 1. Receive 3 arguments: . prob : a float number repsenting the probability of your friend buying the mug at any given day . numDays : an integer number repsenting how many days you need to wait until the paycheck arrives . scenarios : an integer number representing how many scenarios you will run to determine the output probability 2. For each scenario, calculate the number of times the outcome was you buying the tea or the mug. For each day that the mug was not purchased yet use the mugPurchase function from part 1. . If the mug gets purchased before you reach the final day of the numDays , you can move one to the next scenario. As you already have your outcome. 3. Returns a float: the probability of you purchasing the tea collection. Also, please provide 5 extra test cases like the ones shown: . You may vary the number of scenarios and the number of days to wait for the paycheck [1] : import numpy as np # Your solution creating the second part of the function that takes the result from the above function and adds the amount of purchases prob: probability of a mug being purchased , float number numDays: Integer that represents how many days you must wait for a paycheck scenarios: an integer number that represents how many iterations must occur to determine the outcome

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Mobile Communications

Authors: Jochen Schiller

2nd edition

978-0321123817, 321123816, 978-8131724262

More Books

Students also viewed these Programming questions

Question

=+a. Can you list what three of those assumptions likely are?

Answered: 1 week ago