I have encountered an error while coding in Python while programming form the unit 6 in introduction to OOP's with Python. I was working with the following code:
class Participant:
def init(self, name):
self.name = name
self.points = 0
self.choice = ""
def choose(self):
self.choice = input("{name}, select rock, paper or scissor: ".format(name= self.name))
print("{name} selects {choice}".format(name=self.name, choice = self.choice))
class GameRound:
def init(self, p1, p2):
p1.choose()
p2.choose()
def compareChoices(self):
print("implement")
def awardPoints(self):
print("implement")
class Game:
def init(self):
self.endGame = False
self.participant = Participant("Spock")
self.secondParticipant = Participant("Kirk")
def start(self):
game_round = GameRound(self.participant, self.secondParticipant)
def checkEndCondition(self):
print("implement")
def determineWinner(self):
print("implement")
game = Game()
game.start()
Then I encountered the an error saying :- AttributeError: 'Game' object has no attribute 'participant'.
Then I tried typing 'participant' in game.start(). But this didn't fix it. Then I tried typing digits, quotation marks, etc.
MY PC SPECIFICATIONS - Windows 10 Home (x64), Python 3.9 (from Microsoft Store) run through Command Prompt.
The above screenshot is the set of errors I have encountered.
6-exercise-game-transitions-with-methods
This is the link of the exercise I was working with. Please help me fix this issue. I also referred this link -typeerror-method-takes-1-positional-argument-but-2-were-given
THANKING YOU.