This is a python program to shuffle deck of cards (tested in version 3.4)
Output:
You got:
8 of Diamond
3 of Diamond
12 of Diamond
11 of Spade
11 of Club
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | # Python program to shuffle deck of cards # deck of card using the # module random and draw 5 cards # import 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]) |
Output:
You got:
8 of Diamond
3 of Diamond
12 of Diamond
11 of Spade
11 of Club
Comments
Post a Comment