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

Thomas Eruchie
seal-mask
.a{fill-rule:evenodd;}techdegree
Thomas Eruchie
Python Web Development Techdegree Student 1,175 Points

exception handling relating to max length of a character

this is a quiz relating to throwing an exception when certain length of character input is less than 3

suggestinator.py
def suggest(product_idea):
    return product_idea + "inator"

3 Answers

Jeff Muday
MOD
Jeff Muday
Treehouse Moderator 28,720 Points

Thomas,

What is your question on the challenge? Hint, it should look something like this:

def suggest(product_idea):

    # some code goes here that will throw an error

    return product_idea + "inator"
Thomas Eruchie
seal-mask
.a{fill-rule:evenodd;}techdegree
Thomas Eruchie
Python Web Development Techdegree Student 1,175 Points

i did this

def suggest(product_idea): if product_idea < 3 : raise ValueError("it should be above 3") return product_idea + "inator" product_idea = input("Do you understand? ") product_idea = len(product_idea)

Jeff Muday
MOD
Jeff Muday
Treehouse Moderator 28,720 Points

Thomas, nice work on that.

Kenneth places plenty of emphasis on how to raise errors. It really makes troubleshooting code much easier.