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 trialDebasis Nath
3,316 Pointsi have converted the arguments in to floats it's showing error?
def add (x,y): x=float(x) y=float(y)
def add (x,y):
x=float(x)
y=float(y)
Debasis Nath
3,316 Pointsit's juts showing bummer !
2 Answers
Chris Howell
Python Web Development Techdegree Graduate 49,702 PointsHey Debasis Nath
So two things here. Python tries to interpret whitespace, uses it to figure out where your blocks of code are at. Best way I could describe it is...
def add (x,y):
x=float(x) #thinks this is part of a block
y=float(y) #thinks this is part of another block
vs.
def add (x,y):
x=float(x) #these are within the same block.
y=float(y)
Also to pass this challenge it says that you must add them up and return the total. So once you have that piece it should pass.
Let me know if that helps!
Debasis Nath
3,316 Pointsnope ! still the same error
Chris Howell
Python Web Development Techdegree Graduate 49,702 PointsEverytime you indent, it should be 4 spaces for each indentation. :)
jacksonpranica
17,610 PointsIsn't your error coming from the fact that it wants you to return a value?
So don't you want to
return x+y
at the end of your function?
Chris Howell
Python Web Development Techdegree Graduate 49,702 PointsYes it will be, after he fixes the other error. RIght now he is getting a "Bummer, Try again" once he fixes indentation. He will get a different error resulting from not returning. ;)
jacksonpranica
17,610 Pointsjacksonpranica
17,610 PointsWhat is the error?