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 trialChase Alfrey
996 PointsStrlen.py python lesson problem
It's telling me to have it detect the length of the string and say if it's too big or too small, but it just won't work for some reason. Can somebody help me?
def just_right(string):
if len(string) < 5:
return "Your string is too short"
elif len(string) > 5:
return "Your number is too long"
else:
return True
1 Answer
Stuart Wright
41,120 PointsAll of the logic in your code is correct, you just need to fix one of your strings:
"Your number is too long"
should be:
"Your string is too long"
It's always the simple things... :)
Chase Alfrey
996 PointsChase Alfrey
996 PointsI canβt believe I missed that! I was making a number game earlier, so I mustβve got used to typing number instead of word.