Search
 
SCRIPT & CODE EXAMPLE
 

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])
Comment

PREVIOUS NEXT
Code Example
Python :: reactstrap example 
Python :: python get time executed by function 
Python :: create a dict from two lists 
Python :: how to delete in python 
Python :: arma-garch model python 
Python :: Reversing Ints 
Python :: python binary tree search 
Python :: np random list 
Python :: plot circles in matplotlib 
Python :: python dictionary get vs setdefault 
Python :: pandas make currency with commas 
Python :: python check if string is in a list 
Python :: seaborn factorplot python 
Python :: rotate linked list 
Python :: extract decimal number from string python 
Python :: requesting with aiohttp 
Python :: torch cos 
Python :: sns swarm plot 
Python :: python different types of loops 
Python :: python tkinter treeview column width auto 
Python :: conda create new env 
Python :: plotly pdf report 
Python :: how to remove last item from list python 
Python :: max python 
Python :: cv2 videowriter python not working 
Python :: with torch.no_grad() if condition 
Python :: torch.stack 
Python :: python list remove duplicates keep order 
Python :: subplots 
Python :: np.all 
ADD CONTENT
Topic
Content
Source link
Name
3+4 =