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 trialCH. K Sri Krishna
516 PointsTry & Except
I need you to make a new function, add. add should take two arguments, add them together, and return the total.
Not able to get where i am doing wrong.
Please help me out
try:
def add(num1,num2):
return(num1+num2)
1 Answer
Jonathan Fernandes
Courses Plus Student 22,784 PointsHey friend, I have a thought for you!
The challenge asks you to create a function and you are creating one and wrapping it in a try statement. Can you try the following for me and tell me what happens:
def add(num, num2):
return num + num2
Let me know what you get!
CH. K Sri Krishna
516 PointsCH. K Sri Krishna
516 PointsThanks Friend, I have done the task by following below steps def add(num1,num2): return(num1+num2)
Found no error this time....
Jonathan Fernandes
Courses Plus Student 22,784 PointsJonathan Fernandes
Courses Plus Student 22,784 PointsYeah, then the function definition in the try statement was throwing you off then.
Let me know if you have any more questions!