⊕
⊖
Contents
Lambda Function that returns None in Python
In Python, we can define a Lambda Function that always returns None.
The following lambda function always returns None, for any arguments.
lambda *args, **kwargs: None
Examples
1. Write a lambda function that returns None
In the following program, we define a lambda function, mylambda, that always returns None.
Output
None
Try passing some arguments to the lambda function. Still it returns None.
Python Program
myLambda = lambda *args, **kwargs: None
print(myLambda(14, 36, 'apple'))
Run Code CopyOutput
None
Summary
In this tutorial of Python Lambda Functions, we learned how to write a lambda function that always returns None.
Next Topic ⫸ Python - Lambda function that returns True or False
⫷ Previous Topic Python - Lambda function that returns multiple values