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

Justin Lee
Justin Lee
Courses Plus Student 593 Points

can't figure this out, help.

not sure what's wrong

def just_right(five):
    five = []
    if len(five) < 5:
        print("Your string is too short")
    elif len(five) > 5:
        print("Your string is too long")
        return True

1 Answer

Brett McGregor
Brett McGregor
Courses Plus Student 1,903 Points

Hey Justin Lee

I'm still pretty new to Python so my advice is a little sketchy...

The thing that stood out to me in your code was where you make five into a list.

do you need a list to get the required output? What does your initiation of that list do with the source data?

Keep it up!

[edit] I also notice that the question asks you to return rather than print

Justin Lee
Justin Lee
Courses Plus Student 593 Points

Thought that len can only be use on a list. I tried without that line but it still doesn't work