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
Oh man! Everything seems so different on these tasks than on the video.
I swear I am getting down everything the instructor is saying, but whenever I take on these tasks, it feels like I'm doing something completely different than anything related at all to the video I watched before. It's also different than what I did in Workspaces. It's getting really confusing and I'm losing confidence when I can't get over the Basic Python courses and I still have much harder courses ahead of me.
try: a = float(1) b = float(2) except ValueError: return(None) else: return(a+b)
K.D. Harris11,223 Points
it's ok, don't feel discouraged! you'll get it :)
def add(arg1, arg2): try: #this block converts both arguments to floats before adding them together arg1 = float(arg1) arg2 = float(arg2) except ValueError: #...unless there is a valueerror indicating that the arguments are not integers return None else: #if there is no valueerror/the arguments are integers, then the above try block worked and you can add total = arg1 + arg2 return total
try: a = float(1) b = float(2)
here you are converting the integers to float.
try converting your function variables to float.
try: a = float(a) b = float(a)
then challenge will pass.