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 trialNicolas Curat
2,995 PointsWhy isn't my code working
I don't understand what is the problem in my code. I've tried it by my own and it works just fine but the challenge is not accepting it. Please help!
def just_right(text):
if len(text) < 5:
print("Your string is too short")
elif len(text) > 5:
print("Your string is too long")
else:
return True
2 Answers
Jennifer Nordell
Treehouse TeacherHi there! I believe it's simply a misunderstanding of the instructions. The challenge asks you to return the strings, but you are printing the strings. Try returning the strings instead.
Hope this helps!
timoburmeister
550 Pointsdamn! I tried for hours now and completely went insane about that...
and now it works. thanks for the hint and perhaps you could fine tune the instructions a little bit :D
Jennifer Nordell
Treehouse TeacherTo be clear, I am not Treehouse staff. I'm a student just like yourself. That being said, the instructions do explicitly state to return the strings. If you can think of better wording, you might send a suggestion to help@teamtreehouse.com. It has been my experience that they love to get feedback from students.
Nicolas Curat
2,995 PointsNicolas Curat
2,995 PointsThank you! You were right, I had to return them instead of printing them.