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

Python Python Basics (2015) Number Game App String length

Daniel McFarlin
Daniel McFarlin
5,168 Points

just_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?

strlen.py
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
Steven Parker
231,007 Points

You 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.

Daniel McFarlin
Daniel McFarlin
5,168 Points

man I am having a lot of facepalm moments learning code... lol Thanks for the help! Much appreciated!

Actually 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... :laughing:) picky. If you do anything that the challenge doesn't like, your computer will self-destruct. (Just kidding :laughing: it won't destruct but it will not let you pass the challenge.)

Just like Steven's answer, the challenge asked you to return rather than to print. Try switching print with return.

yeah man no problem ?

Good job solving your problem Daniel!