"Animations and Transitions " was retired on December 9, 2019.

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

i don't understand why this is not working

def add("John", "Kelsey"): total = float("John" + "Kelsey") return total

trial.py
def add("John", "Kelsey"):
    total = float("John" + "Kelsey")
    return total

2 Answers

The challange is asking you to add two arguments and return the total. You are defining two strings, and not two variables.

Change this:

def add("John", "Kelsey"):
    total = float("John" + "Kelsey")
    return total

To this:

def add(John, Kelsey):
    total = float(John + Kelsey)
    return total

Hello

you cant cast string to float unless they are 'numeric' string ... note the ' '

example

total = float("1.005") + float("2.055")
should work

total = float("John") + float("Kelsey")
should not work

what you can do is
 total = "John" + "Kelsey"
even better
 total = "John" + " Kelsey"
or 
 total = "John" + " " + "Kelsey"
to have a space