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 Functions and Looping Raise an Exception

David Garcia
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
David Garcia
Python Development Techdegree Graduate 11,254 Points

I doing everything i know for the most part...

well i'm doing everything this question is asking for, but i'm still not able to figure it out am I overthinking it? am i forgetting something? also do I add "try" and "except" functions? or am i over doing the question or under doing it? When i go check to see whats wrong with the code it says: TypeError: '<' not supported between instances of 'str' and 'int' this has me shook .. i feel like it wants me to do more than what i did but i dont know

1 Answer

Oskar Lundberg
Oskar Lundberg
9,534 Points

Hey David! If you were to include your code, I would probably be able to see whats wrong. but for now, I will just show you an example of my solution which completed the challenge.

def suggest(product_idea):
    if len(product_idea) < 3:
        raise ValueError
    return product_idea + "inator"

If you want me to check your code, just respond back with it, otherwise I hope my code can help you figure out whats wrong :D

David Garcia
seal-mask
.a{fill-rule:evenodd;}techdegree seal-36
David Garcia
Python Development Techdegree Graduate 11,254 Points

your a life saver my guy i completely forgot about (len) which counts the characters in your text. I didnt even think about (len) what so ever. THANK YOU everything was good i just needed to do ---> len(product_idea) and that was it