Python Functions
Python Functions
A single statement or set of statements for doing the specific operation and returning output
It should come with common or repetitive tasks which make a function. In place of coding the same snippet multiple times for different parameters, we can group it or summarize as function.
Types Of Functions:
- built-in functions (print, range)
- user defined functions (Our set of code)
Example :
Pass by Reference or pass by value?
variable name —> reference.
Whenever we send/pass a variable/argument to a function, one new reference to the object is being created.
Parameter pass in Python—> reference pass in language Java.
Default argument/Parameter pass:
Assumes a default value/Argument if no value (NULL) available for function call for that particular values/argument.
Variable length arguments:
Contains normal(argument/variable) and keyword (fixed words) variable/dynamic number of arguments/variables
Anonymous functions:
Lambda function / one line function for efficient and short functions
Click Here-> Get Python Training from Expert