Python Data Science Interview

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.


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *