Question: I NEED HELP AS ASAP Python Program: random sampling with replacement A deck of 52 cards contains: 13 Clubs 13 Diamonds 13 Hearts 13 Spades

I NEED HELP AS ASAP

Python Program: random sampling with replacement

A deck of 52 cards contains:

  • 13 Clubs
  • 13 Diamonds
  • 13 Hearts
  • 13 Spades

You randomly draw a card. The card will be any card of the 52 cards (suit name and number). Then you put it back and draw a card again, and put it back again. DO this repeatly 5200 times. Finally, you will see that you drew around 100 times of each card.

Write a program to perform:

  • the random card sampling(with replacement).:
  • the statistics.

You must use functions to complete this program. You are given some partial frame work. It is your choice to use them or not.

(hints: you might need random, loop, if-condition, list, set, function, and concatenation)

I NEED HELP AS ASAP Python Program: random sampling with replacement Adeck of 52 cards contains: 13 Clubs 13 Diamonds 13 Hearts 13Spades You randomly draw a card. The card will be any card

Step (1). define a function which randomly draw a suit name from (Clubs, Diamonds, Hearts, Spades) In [3]: # define a function which can: randomly draw a suit name from (Clubs, Diamonds, Hearts, Spades) return the suit name # # import random random.seed (100) # Your code starts here: Step (2). define a function which can draw a card from 1-13 In [2]: # define a function which can draw a card from 1-13 return should be one of the number 1-13 # Step (3). concatenate the suit name and card points 5 points In [1]: # combine a card: using + to concatenate two suit name and card point Step (4). use loop to draw cards 5200 times find the total count of each card, . then print out the count of each card . check the total (=5200) In [7]: # draw 5200 cards and count each one # 2 # count the number of each indiviadul card you have then print them like: Spades_10: 104 # Diamonds_13: 84 Hearts_08: 114 # Spades_01: 109 # Diamonds_10: 93 # # compute the total number of all cards: 5200 Step (5). sort all drawn cards by name_letter (Ascending order) In [5]: # # ALL diff. cards: 52 Clubs_01: Clubs_02: Clubs_03: Clubs_04: 96 104 103 119 # # Step (6). sort all drawn cards by count (Descending order) In [6]: # Example: # ALL diff. cards: 52 # # # # # ## Clubs_12: Clubs_04: Hearts_12: Spades_04: Hearts_08: 128 119 117 117 114 n [28]: # end

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 Databases Questions!