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 trialThomas Aarts
970 Pointswhat am I missing on my strlen script?
I'm not sure what I am missing within my script. I wrote a similar script in my external workspace and it worked.
def just_right(): string = str(input("Enter a string: ")) if len(string) < 5: print("You're string is too short") elif len(string) > 5: print("You're string is too long") else: return True just_right()
def just_right(string):
if len(string) < 5:
print("You're string is too short")
elif len(string) > 5:
print("You're string is too long")
else:
return True
4 Answers
Alexander Davison
65,469 PointsA little thing:
The challenge never asked you to print anything. You have to return the messages :)
I think you can make out what's wrong with this hint. ;)
~Alex
Need more hints? Please ask below
Jason Anders
Treehouse Moderator 145,860 PointsIn addition to Alexander, you also have a small typo. Not so much a spelling error, but you are using "You're" (you are), when it should be "Your". This error will also cause a Bummer!
:)
Alexander Davison
65,469 PointsOh I didn't notice that :)
Thanks for letting me know!
Ammar Fatihallah
7,417 PointsThe question never asked you to print, it asked you to return.
Thomas Aarts
970 Pointsthanks. It looks like I was doing too much and took out the input and print functions and it worked. Thanks for all your suggestions!