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 trialPrem Yadav
7,346 PointsNot getting where i'm doing mistake...........
I have successfully run the same program in work space but in this code challenge task it's not accepting. showing bummer Try again.................help asap
def add():
try:
count1 = float(input("Enter your 1st numbers: "))
count2 = float(input("Enter your 2nd numbers: "))
except ValueError:
return None
else:
return float(count1) + float(count2)
#return count1+count2
add()
2 Answers
Ari Misha
19,323 PointsHiya Prem! You are doing way too many stuff. Just follow the instructions given in the challenges. For the reference , your solution should look like this:
def add(a, b):
try:
a = float(a)
b = float(b)
except ValueError:
return None
return a + b
Frank Torchia
18,346 PointsHi Prem,
From the instructions it says:
I need you to make a new function, add. add should take two arguments
It looks like you aren't taking in two arguments to your add()
function. You want it to look something like this def add(count1, count2)
and delete the parts where you are prompting a user for input.
Saman Bir
Courses Plus Student 724 PointsSaman Bir
Courses Plus Student 724 PointsMaybe include count1 and count2 as the function argument?
def add(count1, count2):