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

coding error need help python try and except

having trouble with this part everything seems to be in order but it doesnt seem to work and help?

trial.py
def add(num,numb):
     try:
        a=float(num)
        b=float(numb)
        c=a+b            
    except ValueError:
        return None
    else:
        return c

1 Answer

Ryan S
Ryan S
27,276 Points

Hi Addison,

Your code logic is correct, but notice that your "try" keyword is one extra space past the 4-space indentation. If you make sure everything is aligned properly it should pass.