Question: Write a program in python that takes one floating point argument p and prints out at random either True with probability equal to p, or

Write a program in python that takes one floating point argument p and prints out at random either True with probability equal to p, or False with probability equal to 1 p. Note that a fair coin would correspond to the input p = 0.5. Use random.random() in your solution. Please explain. Thanks!

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!