Question: 4. (2 points) In google.com, search for coin toss. You should get a page the simulation tool presented in the next figure: PLAGAN Figure

4. (2 points) In google.com, search for

4. (2 points) In google.com, search for "coin toss". You should get a page the simulation tool presented in the next figure: PLAGAN Figure 1. Google's coin flip application If a coin is fair, when flipped it should result in "Heads" or "Tails" with equal probability (50% of the time it results in "Heads" and 50% of the time it results in "Tails"). Create a function called unfair coin. The function will have the number w as its parameter. The function must return "Heads" with probability w and "Tails" with probability 1-w. For example, if w = 0.3, 30% of the time the function will return "Heads" and 70% of the time it will return "Tails" (note that here you are applying what you learned in problems 2 and 3).

Step by Step Solution

3.31 Rating (169 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

a programming question about creating a function called unfaircoin that simulates the outcome of an unfair coin toss The function takes a number w as its parameter and returns Heads with probability w ... View full answer

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 Programming Questions!