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 need to return floats plz help

I need to return my 2 arguments as floats but i cant figure it out please help

trial.py
def add(arg1, arg2):
  return(float(arg1+arg2))

3 Answers

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Teacher

Here's a hint: float can only ever take one argument. But there are many people that get stuck on this challenge. These forums are awesome and quite often already have answers to each challenge. Take a peek here https://teamtreehouse.com/community/python-code-challenge-problems

oh wow thanks and yeah i havent fully discovered how to maneuver myself in the forums yet but next time il try the forums before i ask ty so much for your help with my questions :D

So the idea is the float both numbers in the return. While it seems like a general float around arg1 + arg2 would work it is actually like this:

def add(arg1, arg2):
  return(float(arg1) + float(arg2))

You need to float both arguments individually, not the return as a whole.