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

nicholas Christie
nicholas Christie
433 Points

whats wrong?

?

trial.py
def add(float(always,win)):
    return(always+win)

1 Answer

Greg Kaleka
Greg Kaleka
39,021 Points

Hi Nicholas,

The function float only takes one argument. You also can't call a function inside of a function definition like you're doing. Instead, leave your function definition the same (it should simply take two arguments), and then within the function body, individually convert each argument to a float. Something like this:

first_num = float(always)
second_num = float(win)

and then add together the numbers.

Cheers :beers:

-Greg

nicholas Christie
nicholas Christie
433 Points

thanks i did this just had to change my return arguments.

def add(always,win):
    first_num= float (always)
    second_num= float(win)
    return(first_num+second_num)
Greg Kaleka
Greg Kaleka
39,021 Points

Yep that's exactly right! Nice work.