Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Object-Oriented Python (retired) Inheritance Score Method

Game.py Challenge: Answer that seems to be correct returns "Bummer"

I have entered my answer, which is exactly the same as the only posted by Gerald Wells here:

https://teamtreehouse.com/community/having-a-hard-time-understanding-the-question-and-as-a-result-cant-get-correct-answer

However, I keep getting a "bummer, try again" response. I even tried copying and pasting from Gerald Wells's answer, and it still does not work :,(

game.py
class Game:
    def __init__(self):
        self.current_score = [0, 0]
    def score(player):
        if player == 1:
            self.current_score[0] += 1
        else:
            self.current_score[1] += 1

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Oh you're soooo close! In fact, if I just add one single word, your code passes. The problem is that your method shouldn't just take a player, it should also take self. Take a look:

def score(self, player):

If I copy/paste your code and then add the self, your code passes! Hope this helps! :sparkles:

Augh! Thank you!!