More than one argument


#1

plz help

m = 5
n = 13

Add add_function here!

def add_function(x, y):

print add_function(m, n)


#2

Hi @thebosco ,

When reporting a problem, it is best to describe the evidence that there is a problem.

What error message did you get? That is essential information.

You have this function header ...

def add_function(x, y):

However, you have no code inside the function definition.


#3

mr @applylpye thanks, here is code:

m = 5
n = 13
# Add add_function here!
def add_function(m, n):
    retrn x + y
print addfunction(m, n)

function error worked or not?


#4

Check the spelling here ...

retrn x + y

... and here ...

print addfunction(m, n)

Omitting the underscore in a name can cause an error.


#5

retern? ............................- to fill 20 character limit :slight_smile:


#6

No, it should be return.


#7

oh yes thx, silly me


#8

there needs to be a overscore! between the add and function


#9

Yes, the name of the function is add_function. If you remove the underscore, it is a different name.


#10

oh I understand, I have dun that, what next?


#11

If you are still getting an error, post your code again, so we can continue to debug it.


#12

yes plz.

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

#13

You have this function header ...

def add_function(m, n):

The parameters are named m and n. Instead, they should be x and y, according to the instructions, so the header needs to be ...

def add_function(x, y):

Leave the other statements as they are now. For example, this one is fine as it is, because the values of the variables m and n will be assigned to the function parameters x and y when the function is called ...

print add_function(m, n)

Make the necessary change, and if you still get an error, post your code again. Otherwise, let us know that the problem has been resolved.


#14

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