Python Program to Shuffle Deck of Cards

in #python-dev4 years ago
# 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])
Sort:  

Source
Plagiarism is the copying & pasting of others work without giving credit to the original author or artist. Plagiarized posts are considered fraud and violate the intellectual property rights of the original creator.

Fraud is discouraged by the community and may result in the account being Blacklisted.

If you believe this comment is in error, please contact us in #disputes on Discord

Source
Plagiarism is the copying & pasting of others work without giving credit to the original author or artist. Plagiarized posts are considered fraud and violate the intellectual property rights of the original creator.

Fraud is discouraged by the community and may result in the account being Blacklisted.

If you believe this comment is in error, please contact us in #disputes on Discord