Hello again, I am working on a Deck class for a card game and I ran into a brick wall. I have no idea how to get the count function to correctly count what's in the list (which is currently empty). I am also having an issue understanding how to create said list to be filled with items. The hint I was given was to use a loop and another list, but I do not understand it.
My current codes:
Deck class:
class Deck:
def __init__(self):
self.__deck = []
def add52(self, new_deck):
self.__deck.append(new_deck)
@property
def count(self):
return self.__deck
def shuffle(self):
random.shuffle(self.__deck)
return self.__deck
def dealCard(self):
return self.__deck.pop()```
NOTE: There are other classes, but I have purposely left them out as they are irrelevant
Main() function (in case you need it. This is used to test the classes and I need it to be able to run through this):
```py
def main():
print("Cards - Tester")
print()
#test deck
print("DECK")
deck = Deck()
print("Deck created.")
deck.shuffle()
print("Deck shuffled.")
print("Deck count:", deck.count)
print()
if __name__ == "__main__":
main()```
NOTE: There was another block here for the Hand class, but I have left that out for the same reason as before.