Quantcast
Channel: Go4Expert
Viewing all articles
Browse latest Browse all 1987

Trying to remove an object from an object list which is a class variable

$
0
0
Hello, I'm trying to make a card game with objects.

Here's my class deck and my class hand:

Code:
class Deck:

    def __init__(self):
        self.deckcardlist = []
       
    def Populate(self):
        for r in Card.RANK:
            for s in Card.SUIT:
                card = Card(r, s )
                deckcardlist.append(card)
        self.deckcardlist = cardlist

    def Shuffle(self):
        random.shuffle(self.cardlist)

    def Deal(self, Hand):
        if self.deckcardlist !=...
Trying to remove an object from an object list which is a class variable

Viewing all articles
Browse latest Browse all 1987

Trending Articles