Q.1 What is a lambda expression in Python?
Ans. With the help of lambda expression, you can create an anonymous function. Unlike conventional functions, lambda functions occupy a single line of code. The basic syntax of a lambda function is –
lambda arguments: expression
An example of lambda function in Python data science is –
x = lambda a : a * 5
print(x(5))
We obtain the output of 25.
Leave a Reply