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
I'm not sure what i'm doing wrong on this challenge.
I don't know if we were supposed to create an input to get the numbers? It doesn't say that we need to, but I can't get the correct answer here. If anyone can explain what i'm doing wrong, i'd appreciate it.
def add(one, two): try: one = float(one) two = float(two) except ValueError: return ("None.") else: return (one + two) ad = add(3,3) print(ad)
Steven Parker228,025 Points
You're really close! Here are a few hints:
- for the challenge, just define the function, don't call it yourself
- you also won't need to print anything
- None is a special Python keyword. Don't add a period or put quotes around it (that makes it an ordinary string).
- FYI: you don't need parentheses after a return (but they don't hurt anything)