148k views
0 votes
A poker hand consists of 5 cards drawn at random without replacement from a 52 card deck. Using python and the cards data frame you imported, draw a poker hand by sampling from the cards and displaying the resulting sample.

1 Answer

2 votes

Answer:

# Python program to shuffle a deck of card

# importing modules

import itertools, random

# make a deck of cards

deck = list(itertools.product(range(1,14),['Spade','Heart','Diamond','Club']))

# shuffle the cards

random.shuffle(deck)

# draw five cards

print("You got:")

for i in range(5):

print(deck[i][0], "of", deck[i][1])

Output

You got:

5 of Heart

1 of Heart

8 of Spade

12 of Spade

4 of Spade

Step-by-step explanation:

User Greg Humphreys
by
3.2k points