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 trialTerry 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