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

Rolando Aguilera
Rolando Aguilera
4,662 Points

Converting an int to a floating type number before using the converted floated point number in a function!

what's the correct syntax in order to pass the challenge? Thank you very much!!!

trial.py
def add(x,y):
    return(x+y)
c=add(float((4,5))
print(c)

2 Answers

Thomas Fildes
Thomas Fildes
22,687 Points

Hi Rolando,

This isn't as complicated as you think. Here is some code below that I used to pass this part (task 2) of the challenge:

def add(x,y):
    total = float(x) + float(y)
    return total

Hope this helps! Happy Coding!!!