Python Functional arguments

Function Arguments

Arguments are types of information that can be passed onto a specific function. They are mainly specified in the round brackets () or parentheses. We can pass as many arguments, but they must be separated by a comma.

In the Python programming language, we can specify a function that takes a variable number of arguments.

The Variable Function Arguments in Python

In this up till now, functions had a determined number of arguments. However, in Python, there are different methods to specify a function that can take a variable number of arguments.
The three different forms of this type are mentioned below.

Python Default Arguments:

In Python, the Function arguments can have default values. It can give a default value to an argument by practising the assignment operator (=).

Python Keyword Arguments:

If we call a function with any values, those values get allotted to the arguments according to their position. Python enables functions to be called by applying keyword arguments. If we call functions in a way, the order (position) of the arguments can be modified. 

Python Arbitrary Arguments:

Sometimes, in Python, we do not know already the number of arguments that will be caught into a function. But Python enables us to manage this situation by using function calls using an arbitrary number of arguments. You can use an asterisk (*) before the parameter name to signify this kind of argument in the function key.

example code

#defining the func def appre(n): print("Hello",n) #calling the function appre("Future coder")


Image Not Found