Welcome to the Treehouse Community
Looking to learn something new?
Code Not Working
I simply don't know what is happening
Chris FreemanTreehouse Moderator 67,986 Points
You are very close. You need to add the instance reference to the method signature:
class Game: def __init__(self): self.current_score = [0, 0] def score(self, player): # <-- added 'self' if player == 1: self.current_score = self.current_score + 1 else: self.current_score = self.current_score + 1
Darryn Smith32,043 Points
Just as a point of discussion, the following version of the method works as well, but in a single line of code:
def score(self, player): self.current_score[player-1] += 1
For the record, it wasn't so long ago I wouldn't have thought of that either.
Also for the record, I'm here in the first place because I had the same problem as the OP: I didn't know to include 'self' as an argument to the method definition. Thanks to Mr. Freeman for helping us out.