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!
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 trial
Bo ChenCourses Plus Student 848 Points
I'm not sure what to put for the else
The instructions say to add an else but I'm not sure what to put in the else
def add(num1, num2): try: return(float(num1) + float(num2)) except ValueError return(None)
that's pretty good, just a little Syntax mistake you need to finish the line with :
except ValueError: return("And here something that explain the Error: Like \"num1\" or \"num2\" coulnd't cast to float")
actually for this "task" you don't need a else Block. In words you try to cast and add the two numbers and might an error will happen you return a information or do something eles inside of
Like i wanna do something a+b but if an error happen "catch" this error and do something else mostly by this course just return a errormessage.