All about function and arbitrary number of argument and named parameter in Python.

1) The function is a code of block which you call again and again and there is no need to write the same code again and again. There are 2 types of function inbuilt and custom made. len() ,sys.exit().
2) Also when you write a function you need to write code inside this and if you do not want to write a code then simply put pass as word inside this.
3) There are several types of functions parametrize an optional argument in python.Also, you have to remember that id optional argument is last in series or place before default parameter you not able to write this.
4) Also for the optional parameter, you are able to assign none value. Which is a special value.
5) Also sometimes you need an arbitrary number of argument to functions by * before the variable name. It is tuple type and before that you able to write optional and default parameter also.
6) There is also another type where you can pass variable data by using named parameter and in that function, you need to use ** two asterisk or you can use named or optional parameter also before this. Also, the main thing is that when you call such type of function is passed name parameter in that keys are a string only and it can not take a number as a parameter. Is a dictionary which we passed to that function as a named parameter.



Comments