Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Terry Joseph
Courses Plus Student 413 PointsPython Floats Help!
Having trouble converting my arguments into floats!

Terry Joseph
Courses Plus Student 413 Pointswill do!
2 Answers

Dario Bahena
10,697 Points# float() converts and int to a float
# float(9) is 9.0 float(9.0) is still 9.0
# lets say x is the int 9 and y is the int 7
def add(x, y): # x and y are the arguments
# 9.0 + 7.0
return float(x) + float(y)

Terry Joseph
Courses Plus Student 413 Pointsi figured it out can you help me with the next step

Dario Bahena
10,697 PointsHint: use float()
float(9) <-- that is now 9.0 which is a float, fancy for a number with a decimal.

Terry Joseph
Courses Plus Student 413 PointsSo i should make my arguments ints? or how do i make my arguments into floats

Terry Joseph
Courses Plus Student 413 Pointsdef add(x,y): return(x + y) is what i have how can i make this a flaoat
Jennifer Nordell
Treehouse TeacherJennifer Nordell
Treehouse TeacherHi, Terry! I'd be interested to know what you've tried thus far that's failing. This will help us to explain better where you're going wrong and ultimately be a better learning opportunity for you