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 trialVikshith Vishwanath
Courses Plus Student 820 Pointsnot able to get output for the second part of the challenge
def add(5.2,3.8): float(5.2,3.8) sum = 5.2 + 3.8 return(sum)
1 Answer
Daniel Gauthier
15,000 PointsHey Vikshith,
You're using hard coded values as your arguments, which will cause the second step of this challenge to fail.
Try switching your arguments to variables, and rather than grouping them together when you call the float function, call the function once on each variable.
def add(a, b):
return float(a) + float(b)
Good luck with the course!
Daniel Gauthier
15,000 PointsDaniel Gauthier
15,000 PointsAlso, I'm going to leave the code that will pass for the third stage here, since you're likely to struggle with that one considering you got stuck in the second stage.
Keep in mind that this is a cleaner way to complete the challenge than other methods that will pass, so I encourage you to mess around and try a few things before looking at the answer provided.
Note that this passing code does not use the else clause that could be used if you're following the structure shown in the videos.