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 trialVishal Sharma
413 PointsWhy is my code not working with try:? [Solved]
Its telling me that I am not passing Task 1 with this code for Task 3. Why is this? I have used the try: before the code where I convert the numbers to floats and I have the rest of what the question asks for. Help please!
def add(num1,num2):
try:
float1 = float(num1)
float2 = float(num2)
except ValueError:
return None
else:
return (float1 + float2)
1 Answer
Vishal Sharma
413 PointsNever mind, I solved the problem. It was just an indentation issue.
Chris Freeman
Treehouse Moderator 68,454 PointsChris Freeman
Treehouse Moderator 68,454 PointsGlad you were able to figure it out. Please feel free to post again to the forum if you have new questions! Keep up the good work!