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 trialbeven nyamande
9,575 Pointsinstance method
i have updated to this where am i missing it
class Game:
def __init__(self):
self.current_score = [0, 0]
def score(player):
player = [1,2]
for key , value in zip(player,self.current_score):
self.current_score[value] +=1
1 Answer
Kenneth Love
Treehouse Guest Teacherscore()
needs to take self
as its first argument since it's an instance method and needs access to the instance. After that, player
is only going to be the integer 1
or 2
. If it's 1
, change self.current_score[0]
. If it's 2
, change self.current_score[1]
. You don't need zip()
or anything fancy like that.