What is the lambda function for?

ydkdtsifjfzw report abuse

Hi everyone. I recently learned in Python classes at a university what a lambda function is. But I don’t realise what it is used for? Where do I need it?

Answers

Kristi report abuse

You can use it to shorten code if you need a function only once and you will never use it again. Function should be simple enough, otherwise it’s still better to define it separately.

biLLy_041 report abuse

It is convenient to pass a lambda function as an argument to another function, for example map or filter.

Add Answer

Need support?

Just drop us an email to ... Show more