Question: Write an program which loops some number of times (the int variable TRIALS), repeating the following: Create a new Deck and shuffle it.

Write an program which loops some number of times (the int variable TRIALS), repeating
the following:
 Create a new Deck and shuffle it.
 Draw the top two cards.
 If both are aces, add 1 to accumulator variable two_aces_count.
Finally, print out the resulting percentage of times you get two aces: 100*two_aces_count / TRIALS
We'll compare our experimental results with the theoretical calculation in class.

 

2-

Write a program which loops some number of times (define and set an int variable
TRIALS), repeating the following steps TRIAL times:

 Create a new Deck, shuffle it, then create two new (empty) lists hand1 and hand2.
 Deal the top card from the Deck and add it to hand1.
 Do this again, adding the 2nd Deck card to hand2.
 Repeat the previous two steps, dealing the 3rd then adding to hand1, with the 4th dealt and added to hand2.
 Check if BOTH of Card lists have Blackjack: that is, an ace (rank 1) for one card and the other as a rank 10,
11, 12, or 13 face card (10,J,Q,K). If so, add 1 to the two_blackjack_count accumulator variable.
After the TRIALS loop ends, print out the resulting percentage (100*two_blackjack_count/TRIALS). We'll
compute the theoretical % in class and compare it with our experimental results.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock 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 Algorithms Questions!