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 trialChris H
Python Web Development Techdegree Student 1,368 Pointstrial task 3
still not passing?
def add(number1,number2):
try:
number1 = float(number1)
number2 = float(number2)
except ValueError:
return None
else:
return(number1 + number2)
1 Answer
taejooncho
Courses Plus Student 3,923 PointsPlease look at my comment on your previous post. You still did not fix all the things I mentioned... The two codes after try are not indented.. You also need to indent the codes after else:
Chris H
Python Web Development Techdegree Student 1,368 PointsThanks got it now!
taejooncho
Courses Plus Student 3,923 PointsYay! I am glad I was able to help.
Sorry if you found my suggestions to be ambiguous, I tried to make things clear for you.
taejooncho
Courses Plus Student 3,923 Pointstaejooncho
Courses Plus Student 3,923 PointsIf you were confused about me saying indentation, I mean to say put 4 lines before where the code started.
Please note After : the following codes that are inside the function or method, must be indented in python.
See the : after try? Your two codes are not indented thus python will give you an error. The same goes with your return(number1 + number 2). It must be indented.