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!
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
Lalit Aditya400 Points
I need you to make a new function, add. add should take two arguments, add them together, and return the total.
What is the mistake in my code?
def add(num1, num2): return num1+num2 total=num1+num2 total= add(3, 4)
Jennifer NordellTreehouse Teacher
Hi there! You are doing fine, but you added some extra things to the code. The third line
total = num1 + num2. Will cause a syntax error. The variables
num2 are defined only in the function and not available outside the function. But your actual function definition and the code in it is just fine. Simply removing the last 2 lines of your code causes this to pass Step 1 of the challenge.
Hope this helps!