Why can’t I transfer an object between classes? /u/__R3v3nant__ Python Education

I’m trying to make a card game and one of the things I need to do is transfer an object between 2 other objects.

This is the code of the object the card leaves

class PlaceDownPile: def __init__(self,colour="null",number="null"): self.colour = colour self.number = number self.card = [] def removeACard(self, a): self.removed = self.card[0] print(self.removed) a.recievePlaceDownCard(self.removed) self.card.pop(1) 

This is the code of the object the card enters

class DrawPile: def __init__(self): self.cards = [] self.playspace = [] # adds number cards to the mix for colour in Card.colours: for number in Card.normal_numbers: self.cards.append(Card(colour, number)) self.cards.append(Card(colour, number)) self.shuffles = 5*len(self.cards) def shuffle(self): self.cards = shuffle(self.cards,self.shuffles) def recievePlaceDownCard(self, cards): self.cards += cards 

But when I run the function I get this error message:

line 243, in removeACard a.recievePlaceDownCard(self.removed) TypeError: DrawPile.recievePlaceDownCard() missing 1 required positional argument: 'cards' 

Why is it happening?

submitted by /u/__R3v3nant__
[link] [comments]

​r/learnpython I’m trying to make a card game and one of the things I need to do is transfer an object between 2 other objects. This is the code of the object the card leaves class PlaceDownPile: def __init__(self,colour=”null”,number=”null”): self.colour = colour self.number = number self.card = [] def removeACard(self, a): self.removed = self.card[0] print(self.removed) a.recievePlaceDownCard(self.removed) self.card.pop(1) This is the code of the object the card enters class DrawPile: def __init__(self): self.cards = [] self.playspace = [] # adds number cards to the mix for colour in Card.colours: for number in Card.normal_numbers: self.cards.append(Card(colour, number)) self.cards.append(Card(colour, number)) self.shuffles = 5*len(self.cards) def shuffle(self): self.cards = shuffle(self.cards,self.shuffles) def recievePlaceDownCard(self, cards): self.cards += cards But when I run the function I get this error message: line 243, in removeACard a.recievePlaceDownCard(self.removed) TypeError: DrawPile.recievePlaceDownCard() missing 1 required positional argument: ‘cards’ Why is it happening? submitted by /u/__R3v3nant__ [link] [comments] 

I’m trying to make a card game and one of the things I need to do is transfer an object between 2 other objects.

This is the code of the object the card leaves

class PlaceDownPile: def __init__(self,colour="null",number="null"): self.colour = colour self.number = number self.card = [] def removeACard(self, a): self.removed = self.card[0] print(self.removed) a.recievePlaceDownCard(self.removed) self.card.pop(1) 

This is the code of the object the card enters

class DrawPile: def __init__(self): self.cards = [] self.playspace = [] # adds number cards to the mix for colour in Card.colours: for number in Card.normal_numbers: self.cards.append(Card(colour, number)) self.cards.append(Card(colour, number)) self.shuffles = 5*len(self.cards) def shuffle(self): self.cards = shuffle(self.cards,self.shuffles) def recievePlaceDownCard(self, cards): self.cards += cards 

But when I run the function I get this error message:

line 243, in removeACard a.recievePlaceDownCard(self.removed) TypeError: DrawPile.recievePlaceDownCard() missing 1 required positional argument: 'cards' 

Why is it happening?

submitted by /u/__R3v3nant__
[link] [comments] 

Leave a Reply

Your email address will not be published. Required fields are marked *