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 trialSergei Miroshnikov
3,313 PointsBummer try again is very descriptive message , helps a lot to understand the problem clearly
I am doing the challenge, I do not understand what is wrong :)
from game import Game
class GameScore(Game):
pass
def __str__(self):
return 'Player 1:{};Player2:{}'.format(self.score.self.score)
2 Answers
Daniel Johnson
104,132 PointsFirst, you'll need to remove pass from the str method. Then you'll need to format your string with the exact spacing as in the challenge. Also in your format function you used a period where you should've use a comma to separate the values, and these values are arrays as well so you'll need to access the individual values.
from game import Game
class GameScore(Game):
def __str__(self):
return 'Player 1: {}; Player 2: {}'.format(self.score[0], self.score[1])
Sergei Miroshnikov
3,313 PointsThank you, score is a tuple where first element is Player 1 score and second element is Player 2 score?
Daniel Johnson
104,132 PointsYes. Basically, score is a list of values, so you don't want to just put the entire list of values. Instead, you'll want to put only individual values from the list.
William Li
Courses Plus Student 26,868 PointsWilliam Li
Courses Plus Student 26,868 Pointsyes, alternatively, we can unpack the array using
format(*self.score)
.