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

Arturo Barradas
PLUS
Arturo Barradas
Courses Plus Student 7,526 Points

Incorrect grade in a code

I have tested the code in pycharm and it works as expected but your systems is reporting something wrong.

strlen.py
def just_right(msg):
    if len(msg) < 5:
        print("Your string is too short")
    elif len(msg) > 5:
        print("Your string is too long")
    else:
        return True

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi there! Close, but not quite! The challenge explicitly asks you to return the strings, but you're printing the strings.

... return "Your string is too short". If the string is longer than five characters, return "Your string is too long".

Challenges are rather strict and require that you follow the instructions to the letter. Just because it works outside of the challenge does not necessarily mean that it fulfills the challenge requirements.

Hope this helps! :sparkles: