Leverage List comprehenshion to compose a full stack of cards,
get a copy of mixed card from it using random.sample() and draw cards up by list.pop() which will remove the card automatically.
I reduced the RANKS
a bit to shorten the print-outs:
SUITS = ["Clubs", "Diamonds", "Hearts", "Spades"]
RANKS = ["2", "3", "4", "5", "6"] #,'7", "8", "9", "10", "Jack", "Queen", "King", "Ace"]
import random
# in order
StackOfCards = [ f'{r} of {s}' for r in RANKS for s in SUITS]
# return random.sample() of full length input == random shuffled all cards
mixedDeck = random.sample(StackOfCards, k = len(StackOfCards))
print("Orig:",StackOfCards)
print()
print("Mixed:",mixedDeck)
print()
# draw 6 cards into "myHand" removing them from "mixedDeck":
myHand = [mixedDeck.pop() for _ in range(6)]
print("Hand:",myHand)
print()
print("Mixed:",mixedDeck)
Output:
Orig: ['2 of Clubs', '2 of Diamonds', '2 of Hearts', '2 of Spades', '3 of Clubs',
'3 of Diamonds', '3 of Hearts', '3 of Spades', '4 of Clubs', '4 of Diamonds',
'4 of Hearts', '4 of Spades', '5 of Clubs', '5 of Diamonds', '5 of Hearts',
'5 of Spades', '6 of Clubs', '6 of Diamonds', '6 of Hearts', '6 of Spades']
Mixed: ['2 of Clubs', '3 of Diamonds', '6 of Hearts', '4 of Spades', '5 of Clubs',
'3 of Hearts', '6 of Spades', '5 of Hearts', '4 of Diamonds', '3 of Spades',
'2 of Spades', '6 of Clubs', '4 of Clubs', '5 of Spades', '6 of Diamonds',
'2 of Diamonds', '3 of Clubs', '2 of Hearts', '5 of Diamonds', '4 of Hearts']
Hand: ['4 of Hearts', '5 of Diamonds', '2 of Hearts',
'3 of Clubs', '2 of Diamonds', '6 of Diamonds']
Mixed: ['2 of Clubs', '3 of Diamonds', '6 of Hearts', '4 of Spades', '5 of Clubs',
'3 of Hearts', '6 of Spades', '5 of Hearts', '4 of Diamonds', '3 of Spades',
'2 of Spades', '6 of Clubs', '4 of Clubs', '5 of Spades']
Using .pop()
alleviated the need of removing something, if you really dislike it (why would you?) you can recreate a list without elements of another list by:
l = [1,2,3,4,5,6]
p = [2,6]
l[:] = [ x for x in l if x not in p] # inplace modifies l to [1,3,4,5]