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
help please? trial task 3
def add(number1, number2):
try:
number1 = float(number1)
number2 = float(number2)
except ValueError:
returne None
return(number1 + number2)
1 Answer
taejooncho
Courses Plus Student 3,923 PointsHi, there
Looking at your code you are very close!
Just some issues and mistake. First, this part from your code needs adjustment.
try:
number1 = float(number1)
number2 = float(number2)
When you write try your code that is inside the try needs to be indented. Right now your two codes are not indented.
Second, the task want you to write else: so if you write else: before you write return (number1+number2) you will be spot on!
Hope this helps!
Chris H
Python Web Development Techdegree Student 1,368 PointsChris H
Python Web Development Techdegree Student 1,368 PointsThanks, still not getting though?
taejooncho
Courses Plus Student 3,923 Pointstaejooncho
Courses Plus Student 3,923 PointsI copied your code and tried to do the challenge to see what else is wrong and I found a typo in your code. You wrote returne when it should have been return. Other than that, when I fixed your code like I mentioned it should let you pass the task.
Chris H
Python Web Development Techdegree Student 1,368 PointsChris H
Python Web Development Techdegree Student 1,368 Pointsthanks for all your help my code is still not passing can you please show me what its should look like?
taejooncho
Courses Plus Student 3,923 Pointstaejooncho
Courses Plus Student 3,923 PointsOkay, Let me use your code and with comment it might be more helpful.