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 trialAustin Cumberlander
13,997 PointsCreating the "just_right" function challenge.
Challenge Task 1 of 1 Create a new function named just_right that takes a single argument, a string. If the length of the string is less than five characters, return "Your string is too short". If the string is longer than five characters, return "Your string is too long". Otherwise, just return True.
I wrote this code in a separate text editor and it works just fine. Why is it not passing this challenge??
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
just_right('Money')
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
just_right('Money')
1 Answer
Henrik Christensen
Python Web Development Techdegree Student 38,322 PointsYou are supposed to return the strings and not print()
Austin Cumberlander
13,997 PointsAustin Cumberlander
13,997 PointsThanks!