Python Python Basics (2015) Number Game App String length

Kris Rajendren
Kris Rajendren
11,695 Points

just_right function solution

What's wrong with this function? def just_right(string): right_length = 5 message = "Your string is too {}" short_ = "short" long_ = "long" length = len(list(string)) if length < right_length: print(message.format(short_)) elif length > right_length: print(message.format(long_)) else: return True

strlen.py
def just_right(string):
    right_length = 5
    message = "Your string is too {}"
    short_ = "short"
    long_ = "long"
    length = len(list(string))
    if length < right_length:
        print(message.format(short_))
    elif length > right_length:
        print(message.format(long_))
    else:
        return True

1 Answer

Mckenzie Hessel
Mckenzie Hessel
Full Stack JavaScript Techdegree Graduate 20,263 Points

You need to change "print" to "return" in your if and elif statements. Should work fine after that