{{tag>projects cloud club computing virtualization machines VMs AWS Azure GCP}} [[python_club|About the Club]]\\ ==== Python Club Topics - Exercise: Shuffle a deck of cards ==== ==== Exercise: Shuffle and deal cards from a deck of playing cards ==== - Output: Display random cards from a virtual deck - What you learn from the example: - Importing and using library modules - Using loops and lists ==== Solution ==== # 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])