More than one argument 6


#1



https://www.codecademy.com/courses/python-beginner-nzzVa/1/2?curriculum_id=4f89dab3d788890003000096#


Oops, try again. add_function(-16, 19) resulted in an error: add_function() takes exactly 2 arguments (0 given)


m = 5
n = 13
# Add add_function here!
def add_function(m,n):
    print add_function()


#2

When it asks you to add two numbers, you want to return those numbers. Then if you want to print what the function returned, you would "print functionName(param1, param2)". When you call a function, you pass the parameters to the function, so you can run the function as many times as you want with different inputs, so you don't need the m and n variables.

def add_function(m, n):
  return m + n

print add_function(10, 14)

This will run the function and get back the two added parameters. Then putting the print in front of it will print what the function has returned.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.