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

George Lugo
seal-mask
.a{fill-rule:evenodd;}techdegree
George Lugo
Python Web Development Techdegree Student 922 Points

hello i am having trouble when i add the except value error

try: total = float(john) + float(kelsey) except ValueError: return None else: return total

trial.py
try:
    total = float(john) + float(kelsey)
except ValueError:
    return None 
else:
    return total
Jennifer Nordell
seal-mask
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Please note that it can take a while to receive a reply/answer on the forums. There are many of us doing our absolute best to help as quickly and efficiently as possible. That being said, when you post here, you are for the most part addressing other students. It's generally best to confine your question to a single thread and wait for an answer there. We're busy learning too!

My best advice is to give the question some time to receive a response so as to avoid duplicate posts on the forums. If you click on the "Community" link at the top of the page here, you will be presented with a list of current questions. Above that is a search bar and next to it is a filter where you can filter by category. Very often you can find your question already answered because someone else had the same exact one. This will greatly diminish your wait time.

2 Answers

Steven Parker
Steven Parker
229,744 Points

Each task of the challenge builds on the last.

In a multi-task challenge like this, each task builds on the work you did in the previous steps.

It looks like you are on task 3, but some of what you needed for tasks 1 and 2 is missing here. Remember the challenge started out by building a function named add? The other tasks modify how the function works, but everything should still be within that function.

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Hi George! From what I can see here, you haven't defined the function yet or have somehow removed the function declaration. The challenge requires that you still have the function declared and defined.

Hope this helps! :sparkles: