Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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