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 trialjonathan arriaga
416 Pointsneed help? whats wrong with my code
cant figure out whats wrong with my code
def add(ava1,ava2):
try:
a = float(ava1)
b = float(ava2)
except ValueError:
return: none
else:
return (a+b)
2 Answers
Christian Mangeng
15,970 PointsHi jonathan,
three issus in your code:
1) remove the colon after return
2) None always has a capital N
3) check your indentation: try, except and else should have an indentation of one tab (as these are inside the function), while the actions that follow all have one more tab, as these are inside try, except or else (so 2 tabs in total).
Hope that helps
bryonlarrance
16,414 PointsIndentation is incorrect and one extra ':' after return.
jonathan arriaga
416 Pointsjonathan arriaga
416 PointsThank you! i fixed all the issues you pointed out and i was able to solve the challenge. And thank you for the tip on the indentations they have been throwing me off