import random
deck = ["C_Jack", "C_Queen", "C_King", "C_Ace", "C_2", "C_3", "C_4", "C_5", "C_6", "C_7", "C_8", "C_9", "C_10", \
"D_Jack", "D_Queen", "D_King", "D_Ace", "D_2", "D_3", "D_4", "D_5", "D_6", "D_7", "D_8", "D_9", "D_10", \
"H_Jack", "H_Queen", "H_King", "H_Ace", "H_2", "H_3", "H_4", "H_5", "H_6", "H_7", "H_8", "H_9", "H_10", \
"S_Jack", "S_Queen", "S_King", "S_Ace", "S_2", "S_3", "S_4", "S_5", "S_6", "S_7", "S_8", "S_9", "S_10"];
hand = [];
def shuffle(list_in):
list_out = random.choices(list_in, k = len(list_in));
return list_out;
print("Original deck");
print(deck);
deck = shuffle(deck);
print("\nDeck after shuffle");
print(deck);
print('\nWhat is your choice, "Draw", "Shuffle", "Deck", "Hand" or "Stop"?');
user_input = input();
while user_input.lower() != "stop":
if user_input.lower() == "draw":
print('How many cards do you want to draw?')
n = int(input());
my_draw = [];
if n <= 0 or n > len(deck):
print(f'Your choice {n} is out of range, default to one');
n = 1;
while n > 0:
my_draw.append(deck.pop(0));
n -= 1;
hand = hand + my_draw;
print(f'\nYou drew {my_draw}');
elif user_input.lower() == "shuffle":
print("\nOriginal deck");
print(deck);
deck = shuffle(deck);
print("\nDeck after shuffle");
print(deck);
elif user_input.lower() == "hand":
print('\nHere is what you have in your hand')
print(hand);
elif user_input.lower() == "deck":
print('\nHere is what the deck has')
print(deck);
print('\nWhat is your choice, "Draw", "Shuffle", "Deck", "Hand" or "Stop"?');
user_input = input();