I'm trying to create a card dealing program but am having slight difficulty. My code looks like this:
cards = ["ace of spades", "ace of hearts", "2 of diamonds"] etc...
firstcard = random.choice(cards)
del cards[firstcard]
print(firstcard)
I am trying to remove the card that is chosen from the array and store it (so I can delete it for it not to be dealt twice) at the same time in order to print it.
I have been receiving this error: TypeError: list indices must be integers or slices, not str, however I'm not sure what other functions exist to help me.
Thanks!