Answered step by step
Verified Expert Solution
Link Copied!
Question
1 Approved Answer

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

Step: 1

blur-text-image
Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Income Tax Fundamentals 2013

Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill

31st Edition

1111972516, 978-1285586618, 1285586611, 978-1285613109, 978-1111972516

More Books

Students explore these related Algorithms questions