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 trialjohn mac
Courses Plus Student 725 Pointspls help me to solve this questions ...
pls suggest me a code for solve this question\
1 Answer
Evan Demaris
64,262 PointsHello John,
You should definitely attempt to solve the problem yourself first. Then you can post your code and we can guide you on where you've gone wrong.
That said, to solve the Challenge, you could use the following code; I haven't watched the videos on the new Python Basics, so I'm not using the else block they suggested (and most likely showed in the videos). However, if you have a question about why/how this code works, let me know!
def add(num1, num2):
try:
return float(num1) + float(num2)
except ValueError:
return None