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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![jmac pd](https://secure.gravatar.com/avatar/e2a59e06e7cdc137b72df774dbad4378?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
jmac pd
11,490 PointsString Length: Am I missing something?
not sure what I am missing here. """ Create a new function named just_right that takes a single argument, a string. If the length of the string is less than five characters, return "Your string is too short". If the string is longer than five characters, return "Your string is too long". Otherwise, just return True. """
Maybe I am reading the question wrong?
def just_right(num1):
if len(num1) < 5:
print("Your string is too short")
elif len(num1) > 5:
print("Your string is too long")
else:
return True
2 Answers
![Timm Derrickson](https://uploads.teamtreehouse.com/production/profile-photos/7842102/micro_profilepic.jpg)
Timm Derrickson
21,205 PointsYour logic is fine, just re-read the question. You need to return the answer, not print it. So, on each of your conditionals, instead of printing the answer on the first two, return them.
I hope that helps.
![jmac pd](https://secure.gravatar.com/avatar/e2a59e06e7cdc137b72df774dbad4378?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
jmac pd
11,490 Pointsthat's it! I make that mistake too often to not have caught it.
I'm over here running my code in the shell scratching my head for 2 days.
thank you.
![Timm Derrickson](https://uploads.teamtreehouse.com/production/profile-photos/7842102/micro_profilepic.jpg)
Timm Derrickson
21,205 PointsNo problem. I have done it several times. I ran your code and started scratching my own head wondering why it was not counting it as correct. So you are not the only one!