I'm beginner with Python. I know only C++/C# so...
My problem is append
to my array some object which is Card
with 2 parameters, card has color and value
part of code doesn't work
class Game:
table = []
....
def play(self, *players):
for singlePlayer in players:
self.table.append(singlePlayer.throwCard())
function throwCard()
in Player
def throwCard(self):
cardToThrow = self.setOfCards[0]
del self.setOfCards[0]
return cardToThrow
"main"
player1 = Player()
player2 = Player()
game = Game()
game.play([player1, player2])
Do you have some suggestions?
AttributeError: 'list' object has no attribute 'throwCard'