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

Oliver White
5,948 PointsWhat is wrong with this ? OOP dice rolling
Hello
It is giving no preview and no useful error - no idea why this is not happy the code is the same as we generated in the lesson
class Song:
def __init__(self, artist, title, length):
self.artist = artist
self.title = title
self.length = length
def __int__(self):
return self.value
def __eq__(sef,other):
return int(self) == other
def __lt__(self,other):
return int(self) < other
def __gt_(self,other):
return int(self) > other
def __le__(self,other):
return int(self) < other or int(self) == other
def __ge__(self,other):
return int(self) > other or int(self) == other
1 Answer

Travis Alstrand
Treehouse Project ReviewerYou're on the right track here Oliver White ! 🎉
After fixing that missing underscore that you mentioned in the __gt__
method, I found two small things.
It's wanting the
__int__
function to return thelength
, not thevalue
There is also a typo in the
__eq__
parameter, it currently sayssef
instead ofself
.
You're absolutely right in that error message is not helpful at all. I'll see if that's something that can be adjusted. Thanks for pointing that out!

Oliver White
5,948 PointsThanks for this
Not sure how I missed such basic errors -- I get frustrate when all the feedback you get is "Bummer try again" -- does not give you much to help you break down the issue -- oh well - thanks so much -- hope not to make such basic mistakes again

Travis Alstrand
Treehouse Project ReviewerNo worries, when working in common IDE's they will normally point out small mistakes like this to you as you type. I still make mistakes like this all the time, don't worry at all, you're doing great!
The true issue here was the error message you were receiving for sure. That gave you no clues on why you weren't passing. I'm going to try my best to get that changed up for the next students but from what I understand it's quite the process.
I'm glad you made it through it! 👏💪
Oliver White
5,948 PointsOliver White
5,948 PointsNot sure why the "or" is not showing up - if you highlight the row it is there in the code
also spotted the missing underscore after corrected and still not running def _gt(self,other): return int(self) > other