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

I cant get past this question. Please explain what i'm doing wrong or at least provide a solution i can compare to?

The scrip dose its job, but isn't passing the question. Why????

Ran 1 test in 0.000s OK

EE

ERROR: test_exception_not_raised (main.TestRaiseExecution)

Traceback (most recent call last): File "", line 23, in test_exception_not_raised File "/workdir/utils/challenge.py", line 20, in execute_source exec(src) File "", line 7, in

EOFError: EOF when reading a line

ERROR: test_exception_raised (main.TestRaiseExecution)

Traceback (most recent call last): File "", line 30, in test_exception_raised File "/workdir/utils/challenge.py", line 20, in execute_source exec(src) File "", line 7, in

EOFError: EOF when reading a line

Ran 2 tests in 0.002s FAILED (errors=2)

suggestinator.py
def suggest(product_idea):
    if len(product_idea) < 3:
        raise ValueError("that suggestion will not work.")
    return product_idea + "inator"

try:
    product_idea = input('what is your suggestion? ')
    new_name = suggest(product_idea)
except ValueError as err:
        print('must be greater then three letters.')
        print('{}'.format(err))
else:
              print(new_name)

2 Answers

Steven Parker
Steven Parker
220,415 Points

It looks like you did a good bit of things not asked for in the instructions. In particular, you won't need any "try" or "except", and you won't need to "input" or "print" anything.

Your task is only to modify the function, you won't need to call it yourself.

Thank you for the fast response! You were correct. I submitted the function and it passed. looking at it now can see that I did well more then needed. Tho it did cement the thought path covered in this section!