I have a card class and deck class. The cards are in
I call the cards from a file cards.txt and split them into the above.
I need to import the cards.txt and then shuffle them. I have the following code:
nCards = len(self.cards)
# Swap randomly selected card i with randomly selected card j
for i in range(nCards):
j = random.randrange(i, nCards)
[self.cards, self.cards[j]] = [self.cards[j], self.cards]
How do I get the cards shuffled and then use the shuffled deck to display the cards using Deck().