Python Python Basics (2015) Number Game App String length

Siddharth Pande
Siddharth Pande
8,064 Points

what is wrong in my code?

what is wrong in my code?

strlen.py
def just_right(str_1):
    if len(str_1) < 5:
        print("Your string is too short.")
    elif len(str_1) > 5:
        print("Your string is too long.")
    else:
        return True
Maximiliane Quel
Maximiliane Quel
Pro Student 55,482 Points

Hi Siddharth,

the challenge asks you to return rather than print:

def just_right(string):
    if len(string) < 5:
        return "Your string is too short"
    elif len(string) > 5:
        return "Your string is too long"
    else:
        return True

2 Answers

Hey Siddharth! Your close, but you weren't suppose to print anything. Instead of printing those string, return them.

Hope this helps!