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 trial

Python Object-Oriented Python (retired) Inheritance __str__

Rabih Atallah
Rabih Atallah
3,405 Points

please any help

please any help would be appreciated for this challenge

game_str.py
from game import Game
class GameScore(Game):
  pass
def __str__(self):

  return 

1 Answer

Vittorio Somaschini
Vittorio Somaschini
33,371 Points

Hello Rabih!

First thing is that you need to get rid of that pass keyword after you complete the 1/2 part of the challenge you don't need it anymore. Also, please note that the class method has to be define inside the class, so indentation matters!

The way you defined the method seems good tome, let's see what we need inside the method; "return the score in the string "Player 1: 5; Player 2: 10", using the correct values from self.score. self.score is a tuple with Player 1's score and Player 2's score like (5, 10)."

So I would type something like this:

return "Player 1: {}; Player 2: {}".format()

Where between the parenthesis we need to access the tuple and get the right values, I will that you, you may want to double check the video of the lesson

;)

Let me know if still issues

Vittorio

Rabih Atallah
Rabih Atallah
3,405 Points

Thanks so much Vittorio!! It worked ( thanks for this hint to remove the pass keyword)