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 trial

Python Python Basics (2015) Logic in Python Try and Except

can't get it

can't solve it

trial.py
try : 
nums = float(num1,num2)
except ValueError : 
print("sadf")
else : 
  print("dsf")

1 Answer

Steven Parker
Steven Parker
231,269 Points

Except for the presence of a try, this code doesn't seem related to what the challenge is asking. Remember, each task builds on what you did in the previous one. You shouldn't be printing anything for this challenge.

Didn't you pass task 1 by creating a function? You'll need to keep that function as you go to the next tasks.

Didn't you also pass task 2 by converting each argument individually to a float? You'll want to keep that part also.

For the last task, you'll put your other parts inside a try and then use an except to return "None" in case the other parts fail.