Question

use python3 Create a function that simulates the probabilities of the following scenarios. Then return list...

use python3

Create a function that simulates the probabilities of the following scenarios. Then return list with corresponding probabilities.

A coin is tossed three times. What is the probability that exactly two heads occur, given that:

(a) the first outcome was a head? (b) the first outcome was a tail? (c) the first two outcomes were heads? (d) the first two outcomes were tails? (e) the first outcome was a head and the third outcome was a head?

For each scenario, calculate the true probability and ensure your estimate is within 10 percent of true probability.

import numpy as np
from math import factorial
def myfunction5():
your code here

return (a)

0 0
Add a comment Improve this question Transcribed image text
Answer #1
There are 3 coins and there can be 2 possible outcome of each coin H or T.
The sample space has size 2^3=8 and consists of triples(since 3 coins are tossed)
 HHH
 HHT  - exactly 2 heads
 HTH  - exactly 2 heads
 HTT
 THH  - exactly 2 heads
 THT
 TTH
 TTT


def my_function():
    result_list = []
    a = 2/8   # (a) the first outcome was a head i.e from the above sample space only HHT and HTH satisfy the condition
    b = 1/8   # (b) the first outcome was a tail i.e from the above sample space only THH satisfy the condition
    c = 1/8   # (c) the first two outcomes are heads i.e from the above sample space only HHT satisfy the condition
    d = 0 # (d)the first two outcomes are tails i.e from the above sample space no sample will have 2 heads under this condition
    e = 1/8  # (e) the first outcome was a head and the third outcome was a head i.e.from the above sample space only HTH satisfies the condition
    # add the required probabilities a,b,c,d,e to the result_list
    result_list.append(a)  
    result_list.append(b)
    result_list.append(c)
    result_list.append(d)
    result_list.append(e)
    return result_list


list_1 = my_function()    # calls the my_function() and stores the returned list into the list_1
print(list_1)    # prints list_1

SCREENSHOT OF CODE WITH OUTPUT:

Add a comment
Know the answer?
Add Answer to:
use python3 Create a function that simulates the probabilities of the following scenarios. Then return list...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT