Indecision, we are going to discuss Biton function arguments.
We know that passing arguments to a function is optional.
We may not pass any argument.
We may pass one or more than one arguments.
So argument passing to be a function is optional.
A function may or may not have arguments past a function can have fixed or variable number of arguments.
As we discussed that very there is a variance while passing variable number of arguments to a function.
So how to parse variable number of arguments to a function so that can be categorized in three different
heads.
So there is a python default arguments based on keyword arguments, then based on arbitrary arguments.
So to discuss more on them, I think that theoretical concept would not be a sufficient enough.
Let us go for one practical demonstration will be showing that how this python different arguments based
on keyword arguments and python arbitrary arguments can get implemented using python coding.
So here is a demonstration.
A function may or may not have its input arguments.
Also, a function may or may not return anything.
So here we are defining one function.
The name of the function is find Max.
It is having A and B as input arguments.
So here, if it is Gellert, then be the return that means which is the maximum one will be returned.
And that's why the name of the function is find Mexia.
So if it is going to then be written else it will return B here.
So this function is having input parameters and B so while calling this kind of X, we are passing parameter
10, which will be assigned to the variable A and also passing twenty, which will be assigned to the
better, will be hit.
So TFN is greater than 20.
The condition is false.
So to return the value beat that is 20 will be returned and that we can print here.
So let us go for the execution.
So Max, number between 10 and 20 is 20.
So if I make this one as 100, if I make this one 100, then obviously the output will be accordingly
changed.
So Max, number between one hundred and twenty is one hundred here.
So in this way, I have shown you that how a function can take input documents and how it can return
a value.
Next one, we're going for this hello here.
We're having to parameters.
One is the name and the one is the message.
The message is having one default argument, so it will print hello and then name and the message.
So here you see we are past the first argument as organismal.
So that will be assigned to the name.
And the second argument we have passed as have a nice day and that will be assigned to the message.
So in the second time when I'm calling this hallow function, we are passing along Nivo not the second
argument we are passing in the case as a second parameter.
Dismissing it will take the default value of the second parameter.
So let us go for the execution.
You can find that.
Hello.
Is coming from this particular string.
So hello univocal.
Have a nice day.
I passed this.
Have a nice day.
So that's why it has got printed accordingly.
Next one is Hello Omnivore.
How are you.
Because I didn't pass the second argument.
Second parameter is not being passed as a result of that.
The default argument is actually getting a sign onto this, onto this message readable.
OK, now let us go for another one.
So here you see we're having one function.
The name of the function is Samal, which will take the function with the arbitrary arguments.
So some is eligible for EI in arguments, some physicalism plus I and return some.
So here, this star will indicate that here you can pass multiple number of arguments as required.
There is no upper limit.
We can pass multiple number of arguments as required.
So in the case for I in AAG, so it will receive one of the arguments at a time and that argument will
get added to the sum before going for this addition to the sum initialized with the value zero.
And then we're having this return sum.
So let us go for the execution.
So with this particular function, we have passed four or five parameters, so one, two, three, four
and five, if we just go on adding, you are going to get here 15.
So that's why some of all the integers between one, two, five is 15 here.
So some of all integers.
So this particular line has got printed.
So in this way you can have a function with a variable number of arguments in our title.
Now let us go for this particular method.
So here the method name is default argument.
It is having three input parameters, A, B and C and their values will get printed.
So default argument has been called with these values 10, 20 and 30.
OK, now let me go for the execution of the same.
I'm finding this one is equal to 10, basically 20 and sees equal to 30 here.
So now I'm just doing some changes in my code.
Here I am not passing the third parameter, I'm passing only 10 and 20.
Then what is the outcome?
We are finding one error.
There is a type error.
It is showing one error.
There is a type error, and it is telling that default argument function is missing.
One regard positional argument, that is see, because I didn't pass the third argument.
So C has got not initialized.
So what we are doing I'm just here quoting here three hundred if you can find that as I did pass the
value for C, so the default argument is getting assigned on the C variable.
OK, no next one.
I'm doing some changes in here.
I'm not passing the value for B if I go on execution, you can find that I'm finding one error and it
is telling that the default argument function missing one required positional argument.
B, so the value for B is missing here.
So that is a problem.
So we are bringing this one in this way.
Removing this problem in this way or resolving this problem in this way.
Now you can find that we're having this 200 the default argument is being assigned and this default
argument is being assigned.
And then as a past, that will be assigned to a here.
OK, next one.
I'm not passing anything.
I'm just making only this one.
So if I go for execution.
You're going to find that default argument function missing, one required positional argument, that
is.
So in that case, what will happen in that case, I should make some default argument to be mentioned.
You see, so all the default values have borders and here so in this way, I've shown you that how the
default arguments are playing their roles now.
Next time I'm going for another one.
I'm just mentioning that B is equal to to to to C is equal to three to three.
And here we are having this eight is equal to one.
One, one.
But having this one.
So now if I go on executing, you can find that.
But having this one, more than two, two, two, two to three, you can also see that I mentioned them
in different order, not in the order in which we have actually defined them in the function input parameters.
So here we can mention explicitly that is two to two will be assigned to be T-3, will be assigned to
C and triple one will be assigned to A and accordingly, the values have mapped.
So I'm just making a copy of it and just withdrawing this assignment.
So in that case, as a value of C is missing.
So the default value three hundred will be assigned to C.
So 300 will be a to see.
So in this way, I've shown you that how these arguments can be of different types, how what is your
default arguments, how to write one function, which will take multiple number of arguments as required.
So we are giving you the demonstration with some examples to make your conception clear on Python functions.
Thanks for watching this video.