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 trialshubham Sharma
1,166 Pointsthe code is working in workspaces as is asked in question but in code challenge it's saying try again
the code is working in workspaces as is asked in question but in code challenge it's saying try again
def just_right(str):
if len(str) < 5:
print("Your string is too short")
elif len(str) > 5:
print("Your string is too long")
else:
print("True")
just_right("shubh")
1 Answer
Jason Anders
Treehouse Moderator 145,860 PointsYour syntax is correct, which is why the code works in Workspaces, but it is not correct to what the challenge is asking for. Instructions for challenges are very specific and very picky. They must be followed exactly or the Code Checker will return a Bummer!
.
Here, there are two issues:
- The instructions say to use
return
, but you are printing. - The instructions say for the final clause to return the Boolean
True
but you have the String "True". Remember, once you put quotes around it, it becomes a string.
Just fix those two things up and the Challenge will pass.
Nice work! :)