Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

Python Program to Shuffle Deck of Cards

# 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])
Source by www.programiz.com #
 
PREVIOUS NEXT
Tagged: #Python #Program #Shuffle #Deck #Cards
ADD COMMENT
Topic
Name
7+2 =