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 trialAli Al Dairawi
Courses Plus Student 877 PointsExhausted from this easy task.
wow, i've been trying everything possible to solve this. i think theres something wrong with my version of the account in treehouse. i swear i tried this like 50 times and i know i'm doing it right, but still get the Bummer error. Any one please help, thank you all.
def add(a,b):
try:
x = float(a)
c = float(b)
except ValueError:
return None
else:
return x+c
2 Answers
Connor Walker
17,985 PointsAll of your code is correct, the only problem is your indentation. In python you need to indent the code inside a function further than the declaration, like this:
def add(a,b):
try:
x = float(a)
c = float(b)
except ValueError:
return None
else:
return x+c
Ali Al Dairawi
Courses Plus Student 877 PointsHi Connor,
Thank you so much i need to remember that indentation is a main key in Python.