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

stefaniewinkler
stefaniewinkler
2,975 Points

I can't find my mistake :( I also tried it in the workspace and it looked good. Has anybody an idea?

It might have something to do with the string. But I can't figure it out. Do I have to transform the input into an string first?

Thanks for any help. Cheers, Stefanie

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

2 Answers

Ari Misha
Ari Misha
19,323 Points

Hiya Stefan! Its a very subtle typo thats failing your challenge. Your returning strings dont have "."(full-stop) at the end. Here is the reference in case you need it.

def just_right(string):
    if len(string) < 5:
        return "Your string is too short."
    elif len(string) > 5:
        return "Your string is too long."
    else:
        return True
stefaniewinkler
stefaniewinkler
2,975 Points

thanks! Shortly after posting I noticed the stupid mistake. Was just used to the print command :D Thank you for the quick response :)

Cheers Stefanie