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 trialGuy-Francis Kono
9,289 PointsConfusing Question
I do not understand clearly what the question is asking me to do. Can someone please clarify?
class Game:
def __init__(self):
self.current_score = [0, 0]
def score(self, player):
player += 1
self.current_score = self.current_score[player]
1 Answer
Cindy Lea
Courses Plus Student 6,497 PointsThis tackle this a step at a time:
Add a score method to Game that takes a player argument = Create a method called Game with an argument player.
The player argument will be either 1 or 2. = Means the argument must contain a value of 1 or 2. This is actually the player#
Increase that player's value in self.current_score by 1. You'll need to adjust the index (i.e. player = 1 means self.current_score[0] needs to increase) means:
Increase each player's score by 1 depending on the argument. Player 1 has an index of 0 in an array & player 2 has an index of 1 in an array.
Guy-Francis Kono
9,289 PointsGuy-Francis Kono
9,289 PointsThank you for the help Cindy.
Once you explained it, I understood what I had to do.