Write a Python program to shuffle and print a deck of card


Topic: Write a Python program to shuffle and print a deck of card

Solution

import itertools, random
deck = list(itertools.product(range(1,14),['Spade','Heart','Diamond','Club']))
random.shuffle(deck)
print("You got:")
for i in range(5):
   print(deck[i][0], "of", deck[i][1])
   
   



List all Python Programs