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 (2015) Logic in Python Try and Except

Why isn't this passing?

I just am not sure what I am doing wrong here.

trial.py
def add(num_1, num_2):
    try:
        a = float(num_1)
        b = float(num_2)
    except Value Error:
        return None
    else:
        return a + b

2 Answers

AJ Salmon
AJ Salmon
5,675 Points

When your exception is a Value Error, there's no space between the two words, so it should say return ValueError. Fix that and you're good to go :)

Conrad Cortes
Conrad Cortes
8,418 Points

I spent so long trying to figure it out that once I posted and refreshed the page I saw you beat me to it!

AJ Salmon
AJ Salmon
5,675 Points

Hahaha, that happens to me all the time. It took me a while to see it, too.

Conrad Cortes
Conrad Cortes
8,418 Points

It took me a while to figure this out... But ValueError needs to be one word.