From c26961bb98e328f536fd013a6a07957e6bcbd1c4 Mon Sep 17 00:00:00 2001 From: Ekansh2006 <72862576+Ekansh2006@users.noreply.github.com> Date: Wed, 14 Oct 2020 16:06:05 +0530 Subject: [PATCH] Create Python Program to Shuffle Deck of Cards In this program, you'll learn to shuffle a deck of cards using random module. --- Python Program to Shuffle Deck of Cards | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Python Program to Shuffle Deck of Cards diff --git a/Python Program to Shuffle Deck of Cards b/Python Program to Shuffle Deck of Cards new file mode 100644 index 0000000..604983b --- /dev/null +++ b/Python Program to Shuffle Deck of Cards @@ -0,0 +1,15 @@ +# 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])