Question

Simulate each part of Problem 1 [Playing Cards] using a Python program. 10,000 trials should be...

Simulate each part of Problem 1 [Playing Cards] using a Python program. 10,000 trials should be plenty to get good approximations for these conditional probabilities.

This is problem 1:

1 [Playing Cards] Two cards are randomly chosen without replacement from an ordinary deck of 52 cards. Let E be the event that both cards are Queens. Let F be the event that the Queen of Spades is one of the chosen cards, and let G be the event that at least one Queen is chosen. Determine the following probabilities: (a) P(E|F) (b) P(E|G)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Python Code:

import random
"""Let a deck is made in such a way that queens are present at position 1,2,3,4 and queen of spades is 
present at position 1, you can choose any other numbers but then you will have to change your program accordingly """
#Calculating P(E intersection F) in 10000 trials
success=0
for i in range(0,10000):
    a=random.randint(0,52)
    while True:
        b=random.randint(0,52)
        if b!=a:
            break
    if a==1 or b==1:
        if a>=1 and a<=4 and b>=1 and b<=4:
            success=success+1
E_and_F=success/10000

#Calculating P(E intersection G) in 10000 trials
success=0
for i in range(0,10000):
    a=random.randint(0,52)
    while True:
        b=random.randint(0,52)
        if b!=a:
            break
    if a>=1 and a<=4 and b>=1 and b<=4:
        success=success+1
E_and_G=success/10000

#Calculating P(F) in 10000 trials
success=0
for i in range(0,10000):
    a=random.randint(0,52)
    while True:
        b=random.randint(0,52)
        if b!=a:
            break
    if a==1 or b==1:
        success=success+1
F=success/10000

#Calculating P(G) in 10000 trials
success=0
for i in range(0,10000):
    a=random.randint(0,52)
    while True:
        b=random.randint(0,52)
        if b!=a:
            break
    if (a>=1 and a<=4) or (b>=1 and b<=4):
        success=success+1
G=success/10000
P1=E_and_F/F
P2=E_and_G/G
print("P(E|F)= ",P1)
print("P(E|G)= ",P2)

Output:

Now let us manually calculate those probabilities and verify the accuracy of simulation:

Add a comment
Know the answer?
Add Answer to:
Simulate each part of Problem 1 [Playing Cards] using a Python program. 10,000 trials should be...
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
  • 1. (25 total points) Probability and card games; Recall that an ordinary decdk of playing cards...

    1. (25 total points) Probability and card games; Recall that an ordinary decdk of playing cards has 52 cards of which 13 cards are from each of the four suits hearts, diamonds, spades, and clubs. Each suit contains the cards 2 to 10, ace, jack, queen, and king. (a) (10 points) Three cards are randomly selected, without replacement, from an or- dinary deck of 52 playing cards. Compute the conditional probability that the first card selected is a spade, given...

  • An ordinary deck of playing cards has 52 cards. There are four suitslong dash​spades, ​hearts, diamonds,...

    An ordinary deck of playing cards has 52 cards. There are four suitslong dash​spades, ​hearts, diamonds, and clubslong dashwith 13 cards in each suit. Spades and clubs are​ black; hearts and diamonds are red. One of these cards is selected at random. Let A denote the event that a red card is chosen. Find the probability that a red card is​ chosen, and express your answer in probability notation. The probability that a red card is chosen is _____=______

  • determine: 1. P(A and B) 2. P(A or B) 3. P( B|A ) Suppose one card...

    determine: 1. P(A and B) 2. P(A or B) 3. P( B|A ) Suppose one card is selected at random from an ordinary deck of 52 playing cards. A standard deck of cards contains for suits: red hearts, red diamonds, black clubs, black spades. Each suite contains 13 cards: Ace, 2,3,4,5,6,7,8, 9, 10, Jack, Queen, King. The Jack, Queen, and King are also called Face Cards. Let A = event a jack is selected B = event a spade is...

  • The Jack of Spades, Jack of Hearts, Queen of Spades, and Queen of Hearts are taken...

    The Jack of Spades, Jack of Hearts, Queen of Spades, and Queen of Hearts are taken from a deck of cards. The four cards are shuffled and two cards are selected from the deck (without replacement). Let A = "Both of the cards you selected are Queens." For (A) - (D), give ?(?)P(A) under each of these conditions. All these problems are to be considered separately. (A) Suppose the first card is a Queen. (B) Suppose that the second card...

  • 2. Yoù have drawn a card from a fully shuffled deck of 52 ordinary playing cards....

    2. Yoù have drawn a card from a fully shuffled deck of 52 ordinary playing cards. Find the probabilities P(Queen or Black) a. b. P (Diamond or Jack)- c, P (Below 4 / not Face)- d. P (Above 7/not Ace)- e. P (Queen/ Face) Let the event (A) be "air temperature To> 25° C" and the event (B) - "high air pressure". If in a certain month there were 12 of 30 days with temperature To> 25° C, 16 days...

  • Consider a standard 52-card deck of cards. In particular (for those unfamiliar with playing cards), the...

    Consider a standard 52-card deck of cards. In particular (for those unfamiliar with playing cards), the deck contains 4 aces, 4 kings, 4 queens, 4 Jacks, 4 10's, 4 94, 4 84, 4 7's, 4 6's, 4 5's, 4 4's, 4 3, and 4 2's, where for each type of card (for example ace), one of the 4 copies is of suit club, one is of suit heart, one is of suit spade, and one is of suit diamond. Consider...

  • 2. Consider a standard 52 card deck of playing cards. In total there are four cards that are Aces, four cards that are Kings, four cards that are Queens and four cards that are Jacks. The remaining 3...

    2. Consider a standard 52 card deck of playing cards. In total there are four cards that are Aces, four cards that are Kings, four cards that are Queens and four cards that are Jacks. The remaining 36 cards are four each of the numbers 2, 310. That is there are four cards that are twos, four cards that are threes etc. For this question, suppose that we reduce the number of cards in the deck by removing one of...

  • 1. A hand of four cards is drawn from a standard deck of 52 playing cards...

    1. A hand of four cards is drawn from a standard deck of 52 playing cards (without re- placement). Determine the probability that the hand contains: (a) four cards of the same value. (e.g. 20, 24, 26, 20). (b) two cards of one value and two cards of another value. (e.g. 3º, 2º, 24, 30) (c) four cards of the same suit. (e.g. 4♡, 2V, AV, K♡). (d) exactly two Queens. (e.g. KV, 36, QO, Qob) (e) exactly three spades....

  • 3. You have a standard deck of 52 playing cards. There are two colors (black and...

    3. You have a standard deck of 52 playing cards. There are two colors (black and red) and four suits (spades are black, clubs are black, hearts are red, and diamonds are red). Each suit has 13 cards, in which there is an ace, numbered cards from 2 to 10, and three face cards (jack, queen, and king) a. You randomly draw and then replace a card. What's the probability it's an ace? What's the probability it's the 4 of...

  • Part 1: Experimental Probabilities. 1. Using a standard deck of 52 playing cards, shuffle the deck...

    Part 1: Experimental Probabilities. 1. Using a standard deck of 52 playing cards, shuffle the deck well, then draw 10 cards. Record the number of diamonds. If you do not have a deck of playing cards go to random.org, under the games and lotteries link, choose playing card shuffler. Repeat this 27 more times (for a total of 28 trials) and record your data below. (10 pts) Draw # of Diamonds 1 2 3 4 5 6 7 8 9...

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