Computer Science, asked by Afjal3325, 11 months ago

def my_func(n1, n2): return n1 + n2 my_func(1, 2, 3)

Answers

Answered by fiercespartan
6

Here is the code:

def my_func(n1,n2): # note that we are just giving the function 2 arguments

   return n1+n2

my_func(1,2,3)

___________________________________________________

In this question, we have function named my_func and this takes in two numbers, n1 and n2 and under the function, we are returning the sum of these two numbers.

Now, later in the code, we call the function but notice that we pass in 3 arguments but, my_func takes in just 2 arguments.

But if we call a function like:

my_func(1,2)

Now that we have 2 arguments, the function will return the sum which is 3.

Similar questions