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 trialsujatanandi
3,523 Pointsneed help with a particular task,str method to GameScore, Why is it not working?
from game import Game class GameScore(Game): pass def str(self): return 'Player 1: {}; Player 2: {}'.format(*self.score)
from game import Game
class GameScore(Game):
pass
def __str__(self):
return 'Player 1: {};Player 2: {}'.format(*self.score)
2 Answers
Haider Ali
Python Development Techdegree Graduate 24,728 PointsHi there, the technical aspect of your code is correct, however, since the challenges here are very picky, it failed since you missed a space after the semicolon in the string you are returning. Here is what it should look like:
from game import Game
class GameScore(Game):
pass
def __str__(self):
return 'Player 1: {}; Player 2: {}'.format(*self.score) #missed space after semicolon
Thanks,
Haider
sujatanandi
3,523 PointsThanks!