Question

write the programe in Python A and B have a coin which they suspect is unfair,...

write the programe in Python

A and B have a coin which they suspect is unfair, because they tossed it 100 times and got 65 heads. They want to decide who goes first in a game and they have no other coin to toss, so they have to use this coin. Describe a method to use this coin to make a fair decision. (There are at least three methods)

0 0
Add a comment Improve this question Transcribed image text
Answer #1
#probability of head=.65
#probability of tail=1-.65=.35
#probability of getting a head after a tail=.35*.65=.2275
#probability of getting a tail after a head=.65*.35=.2275

#thus if we toss the coin 2 times and make a decision based on who gets a TH or HT, the result would be fair
#method which returns the  after a fair toss

import random
def WhoGoesFirst():
    '''if the out come is TH, A goes first ,if it is HT, B does. Any other outcome and we repeat the toss'''
    while True:
        toss1=random.randint(0,100)
        toss2=random.randint(0,100)
        if toss1>65 and toss2<=65:
            return 'A'
        elif toss1<=65 and toss2>65:
            return 'B'

Add a comment
Know the answer?
Add Answer to:
write the programe in Python A and B have a coin which they suspect is unfair,...
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
  • Problem 2: A and B have a coin which they suspect is unfair, because they tossed...

    Problem 2: A and B have a coin which they suspect is unfair, because they tossed it 100 times and got 65 heads. They want to decide who goes first in a game and they have no other coin to toss, so they have to use this coin. Describe a method to use this coin to make a fair decision. (There are at least three methods) Problem 3: Write a program to simulate the method you developed in Problem 2....

  • One application of an absolute value inequality is the concept of the unfair coin. If a coin is tossed 100 times, w...

    One application of an absolute value inequality is the concept of the unfair coin. If a coin is tossed 100 times, we would expect approximately 50 of the tosses to be heads; however this is rarely the case.1. Toss a coin 100 times to test this hypothesis. Record the number of times the coin is heads and the number of times the coin is tails on the lines below. You may want to ask someone to tally the results of...

  • # JAVA Problem Toss Simulator Create a coin toss simulation program. The simulation program should toss...

    # JAVA Problem Toss Simulator Create a coin toss simulation program. The simulation program should toss coin randomly and track the count of heads or tails. You need to write a program that can perform following operations: a. Toss a coin randomly. b. Track the count of heads or tails. c. Display the results. Design and Test Let's decide what classes, methods and variables will be required in this task and their significance: Write a class called Coin. The Coin...

  • 12. Coin Toss Simulator Write a class named Coin. The Coin class should have the following field ...

    12. Coin Toss Simulator Write a class named Coin. The Coin class should have the following field .A String named sideUp. The sideUp field will hold either "heads" or "tails" indicating the side of the coin that is facing up The Coin class should have the following methods .A no-arg constructor that randomly determines the side of the coin that is facing up (heads" or "tails") and initializes the aideUp field accordingly .A void method named toss that simulates the...

  • The next four questions (5 to 8) refer to the following: An unfair coin is tossed...

    The next four questions (5 to 8) refer to the following: An unfair coin is tossed three times. For each toss, the probability that the coin comes up heads is 0.6 and the probability that the coin comes up tails is 0.4. If we let X be the number of coin tosses that come up heads, observe that the possible values of Xare 0, 1, 2, and 3. Find the probability distribution of X. Hint: the problem can be solved...

  • c++ Program 2: Coin Toss Simulator For this program, please implement Problems 12 and 13 in...

    c++ Program 2: Coin Toss Simulator For this program, please implement Problems 12 and 13 in a single program (Gaddis, p812, 9E). Scans of these problems are included below. Your program should have two sections that correspond to Problems 12 and 13: 1) As described in Problem 12, implement a Coin class with the specified characteristics. Run a simulation with 20 coin tosses as described and report the information requested in the problem. 2) For the second part of your...

  • 1 Spinning a coin, unlike tossing it, may not give heads and tails in equal proportions....

    1 Spinning a coin, unlike tossing it, may not give heads and tails in equal proportions. I spin a penny 150 times and got 60 heads. We want to know if we have significant evidence that the coin is not fair. • When we go to the Rossman Chance applet, what value should be entered under "Probability of heads" (or "Probability of success 7")? Round to 3 places. • In the Rossman Chance applet, what value should be entered under...

  • USE PYTHON ONLY Please write a Python program to let you or the user play the...

    USE PYTHON ONLY Please write a Python program to let you or the user play the game of rolling 2 dice and win/lose money. Initially, you have 100 dollars in your account, and the dealer also has 100 dollars in his/her account. You would be asked to enter a bet to start the game. If your bet is zero, the game would be stopped immediately. Otherwise, dealer would roll 2 dice and get a number from ( random.randint(1, 6) +...

  • 8-10 0.4, P(B)0.5, and P(A UB)-0.7, find P(An B) P(A' U B') 6. If P(A) a....

    8-10 0.4, P(B)0.5, and P(A UB)-0.7, find P(An B) P(A' U B') 6. If P(A) a. b. 7. A coin is tossed 4 times and the sequence of heads and tails is observed a. b. What is the sample space S for this experiment? Consider the following events: A [at least 3 heads) B- (at most 2 heads) C- (heads on the 3rd toss) D - [1 head and 3 tails) If the outcomes in S are equally likely, find...

  • 7-10 help 0.4, P(B)0.5, and P(A UB)-0.7, find P(An B) P(A' U B') 6. If P(A)...

    7-10 help 0.4, P(B)0.5, and P(A UB)-0.7, find P(An B) P(A' U B') 6. If P(A) a. b. 7. A coin is tossed 4 times and the sequence of heads and tails is observed a. b. What is the sample space S for this experiment? Consider the following events: A [at least 3 heads) B- (at most 2 heads) C- (heads on the 3rd toss) D - [1 head and 3 tails) If the outcomes in S are equally likely,...

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
ADVERTISEMENT