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 trialElizabeth McInerney
3,175 PointsAdding score to game
I do not understand what I am doing wrong here.
from game import Game
class GameScore(Game):
self.score = 5,10
return "Player 1: {}; Player 2: {}".format(self.score[0],self.score[1])
4 Answers
Jon Peterson
12,661 Pointsfrom game import Game
class GameScore(Game):
self.score = 5,10
return "Player 1: {}; Player 2: {}".format(*self.score)
Elizabeth McInerney
3,175 PointsOh man, was that it??? Ugh, yes, I see! Thanks!
Elizabeth McInerney
3,175 PointsHello, I just posted the question again, because I still can't get it to work, even with your code.
Scott Davis
1,925 PointsSame here, that code would not work as well.
Iain Simmons
Treehouse Moderator 32,305 PointsThe challenge asks you to define a __str__
method within the GameScore class. It also says:
You do not need to define
self.score
. It comes from theGame
class.
Move your return
statement to the new method and you should be good to go. You could also use the format Jon Peterson suggested.