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 trialJoeseph Wolfe
Courses Plus Student 1,010 PointsNot sure what the issue is here my code seems to work just fine in a python interpreter
def just_right(somestr): if len(somestr) < 4: print("Your string is too short") elif len(somestr) > 4: print("Your string is too long") else: True
I am not sure why the quiz is not accepting this as my answer. It has the desired behavior when I use my interpreter to test.
def just_right(somestr):
if len(somestr) < 4:
print("Your string is too short")
elif len(somestr) > 4:
print("Your string is too long")
else:
True
2 Answers
Steven Parker
231,248 PointsJust because code runs, it doesn't prove that it is doing the right thing.
The Challenge asks you to return the strings, not print them.
You also need to return True when the length is right.
Joeseph Wolfe
Courses Plus Student 1,010 PointsThanks Steven !, that was exactly what I was doing wrong.