Question

In: Statistics and Probability

Suppose that your enemy has a set of 20 weighted coins that each has a probability...

Suppose that your enemy has a set of 20 weighted coins that each has a probability of 0.6 of landing heads when flipped. Estimate the mean number of heads if the set was flipped over and over by simulating 250,000 flips of the set and computing the average. (In python)

Solutions

Expert Solution

Python-code

import numpy as np

import random

coinoutcomes = ("H","T")
iterations = 20
simulations = 250000

allflips = []

random.seed(1453)

# function to return the randon value
# on biased biased coin FLIP
# since the probability of heads = 0.6, we have 3 heads and 2 tails in 5 items

def biasedcoin():
    return random.choice(['H','T','H','H','T'])

headsfound = np.zeros((simulations))
coinflips = 0
for j in range(0, simulations):
   
    temp = []
   
    for i in range(0,iterations) :
        temp.append(biasedcoin())

        if temp[i] == "H":
            headsfound[j] = headsfound[j] + 1
           
           
meanheads = np.mean(headsfound)
print("\nAverage heads found = ", meanheads)   

Python-output


Average heads found = 11.99912


Related Solutions

5 coins are put in a bag. 2 of the coins are weighted with the probability...
5 coins are put in a bag. 2 of the coins are weighted with the probability of flipping heads being three times as great than the probability of flipping tails; the remaining coins are fair. One of these coins is selected at random and then flipped once. What is the probability that a weighted coin was selected given that heads was flipped?
Suppose Alice flips 4 coins and Bob flips 4 coins. Find the probability that Alice and...
Suppose Alice flips 4 coins and Bob flips 4 coins. Find the probability that Alice and Bob get the exact same number of heads.
Suppose that Serena has a .7 probability of defeating Venus in a set of tennis, independently...
Suppose that Serena has a .7 probability of defeating Venus in a set of tennis, independently from set to set. For questions 1 – 3, suppose that they play a best-of-three-set match, meaning that the first player to win two sets wins the match. 1. Determine the probability that Serena wins the match by winning the first two sets. 2. Determine the probability that the match requires three sets to be played (meaning that each player wins one of the...
Suppose 16 coins are tossed. Find the probability of getting the following result using the binomial...
Suppose 16 coins are tossed. Find the probability of getting the following result using the binomial probability formula and the normal curve approximation. Exactly 6 heads. Binomial probability = ​(Round to 4 decimal​ places.) Normal curve approximation almost = ​(Round to 4 decimal​ places.)
Conditional probability You have two coins in your pocket. One is a regular coin and the...
Conditional probability You have two coins in your pocket. One is a regular coin and the other is a weighted coin that has a 75% chance of landing heads up. You can’t tell the coins apart by inspecting them. You take a coin out of your pocket and toss it. It lands heads up. a. What is the probability that the coin is the fair coin? b. How many times would you decide to flip the coin before you are...
Suppose a coin is weighted so the probability of heads is really 0.6. Find the exact...
Suppose a coin is weighted so the probability of heads is really 0.6. Find the exact sampling distribution of the sample proportion of 3 flips of the coin that are heads.
Here is a simple probability model for multiple-choice tests. Suppose that each student has probability p...
Here is a simple probability model for multiple-choice tests. Suppose that each student has probability p of correctly answering a question chosen at random from a universe of possible questions. (A strong student has a higher p than a weak student.) The correctness of answers to different questions are independent. Jodi is a good student for whom p = 0.75. (a) Use the Normal approximation to find the probability that Jodi scores 70% or lower on a 100-question test. (Round...
Here is a simple probability model for multiple-choice tests. Suppose that each student has probability p...
Here is a simple probability model for multiple-choice tests. Suppose that each student has probability p of correctly answering a question chosen at random from a universe of possible questions. (A strong student has a higher p than a weak student.) The correctness of answers to different questions are independent. Jodi is a good student for whom p = 0.8. (a) Use the Normal approximation to find the probability that Jodi scores 76% or lower on a 100-question test. (Round...
Here is a simple probability model for multiple-choice tests. Suppose that each student has probability p...
Here is a simple probability model for multiple-choice tests. Suppose that each student has probability p of correctly answering a question chosen at random from a universe of possible questions. (A strong student has a higher p than a weak student.) The correctness of answers to different questions are independent. Jodi is a good student for whom p = 0.83. (a) Use the Normal approximation to find the probability that Jodi scores 79% or lower on a 100-question test. (Round...
Here is a simple probability model for multiple-choice tests. Suppose that each student has probability p...
Here is a simple probability model for multiple-choice tests. Suppose that each student has probability p of correctly answering a question chosen at random from a universe of possible questions. (A strong student has a higher p than a weak student.) The correctness of answers to different questions are independent. Jodi is a good student for whom p = 0.83. (a) Use the Normal approximation to find the probability that Jodi scores 79% or lower on a 100-question test. (Round...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT