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 trialDaniel McFarlin
5,168 Pointsjust_right function and I could have sworn got it "Just Right!... but alas I apparently did not. Why!? What did I do?
just_right function and I could have sworn got it "Just Right!..." but alas I apparently did not. Why!? What did I do wrong? These coding challenges are kind of frustrating because there are no error messages hinting at whatI did wrong. I have no idea where in my code I messed up. Any recommendations?
def just_right(string):
if len(string) < 5:
print("Your string is too short.")
elif len(string) > 5:
print("Your string is too long.")
else:
return True
3 Answers
Steven Parker
231,271 PointsYou need to return instead of print.
If you re-read the challenge instructions, you'll see where it talks about the various things your function should return. But it never says to print anything.
Ammar Fatihallah
7,417 PointsJust like Steven's answer, the challenge asked you to return
rather than to print
. Try switching print
with return
.
Ammar Fatihallah
7,417 Pointsyeah man no problem ?
Alexander Davison
65,469 PointsGood job solving your problem Daniel!
Daniel McFarlin
5,168 PointsDaniel McFarlin
5,168 Pointsman I am having a lot of facepalm moments learning code... lol Thanks for the help! Much appreciated!
Alexander Davison
65,469 PointsAlexander Davison
65,469 PointsActually you are learning coed really well so far. It's just that code challenges are super-duper-truper (uh I guess "truper" isn't a word... ) picky. If you do anything that the challenge doesn't like, your computer will self-destruct. (Just kidding it won't destruct but it will not let you pass the challenge.)