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

You're doing great! Just one more task but it's a bigger one. Right now, we turn everything into a float. That's great

i am not moving forward with this one i can't seem to find the issue

trial.py
def add(num1, num2):
try:
    return float(num1) + float(num2)
except ValueError: 
    return  None
else: 
    return float(num1) +float(num2)

2 Answers

Henrik Christensen
seal-mask
.a{fill-rule:evenodd;}techdegree
Henrik Christensen
Python Web Development Techdegree Student 38,322 Points

It should be like this:

def add(num1, num2):
    try:
        return float(num1) + float(num2)
    except ValueError: 
        return  None
    else: 
        return float(num1) +float(num2)

and not like this:

def add(num1, num2):
try:
    return float(num1) + float(num2)
except ValueError: 
    return  None
else: 
    return float(num1) +float(num2)

I can't find where the issue with the identatioon. Please help

thank you for your help it worked