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

Hope Mallary
Hope Mallary
900 Points

don't get it

help

game.py
class Game:
  def __init__(self):
    self.current_score  = [0, 1] 

    def score(self, player):
        self.current_score +1

1 Answer

Hi Hope

Firstly check your indentation.

class Game:
  def __init__(self): #__init__ runs when the class gets initialized for example mygame = Game()
    self.current_score  = [0, 1] # this setts the attribute current_score to a default of [0,1]

  def score(self, player): # check your indentation. when this method is called the current_score is incremented by 1
    self.current_score +1

hope this helps. For future, give a more detailed explanation of what you want help with.