
Kris Reid
16,364 PointsJust_Right just not working!
I'm not sure why this isn't working! I'm following previous code examples. Perhams my logic is wrong? Can someone help me. It just says "Bummer: Try again" - Not very helpful!
Thanks! :)
def just_right(string):
string = []
if len(string) <5:
print("Your string is too short")
elif len(string) >5:
print("Your string is too long")
else:
return True
1 Answer

Jennifer Nordell
Treehouse TeacherHi there! You're doing great, but there's a bit of a misunderstanding of the instructions here. The challenge asks you to return those strings, but you're printing the strings. Just as the else
clause has a return
statement, so should your if
and elif
. When Treehouse is running your code, it's expecting to get back a response, but the only thing sending back a response is the else
.
Hope this helps!
Also, you will not need the string = []
. This declares an empty list that is overwriting what they are sending in.
Kris Reid
16,364 PointsKris Reid
16,364 PointsPerfect thanks!
I wasn't aware that you could return a message with return thought it always had to be print. I'll have to investigate further!