Python Language / Python FunctionsIt is set of lines of code used to perform a particular task. We can send parameters / data to a function and it may or may not have return values. It is created using def keyword in python.Sample Programs
Example: Recursion program for calculating fib series Recursion The function can calling itself is called as recursion. Its purpose is loop through data to reach a result.
Lambda Function It takes number of arguments, but can only have one expression. Use lambda functions when an anonymous function is required for a short period of time. Example write a program to use lambda function to adds 10 to the number passed as a argument and print result:
|