i want to remove a card from a randomly shuffled deck. so that each time a card is picked from the again shuffled deck. that card is eliminated from further play until all 52 cards are drawn. in python3.7

Since the list can be done in a few ways, let's see the code so far.

You can remove items from a list by index or by content. Assuming a list named deck and a card named card that has been randomly selected from the deck (let's assume at position p) you can remove the card from the deck by

del deck[p]

or

deck.remove(card)

If the deck is shuffled then it makes no difference which card you remove, so why not just remove the last one? (May make no difference in Python, but for languages with simple arrays it's lot easier.)

commented: Doh! +15
commented: Double up! +15
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.