Get the App
SLTechnology News&Howtos  ›  Development  › 

What is the Lambda function in python

Shulou Source: shulou.com Published: 2022-06-01 03:05:53 09月22日 Update

This article mainly shows you "what is the Lambda function in python", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "what is the Lambda function in python" this article.

Lambda function

The Lambda function is a relatively small anonymous function-- anonymous means that it doesn't actually have a function name.

The Python function is usually defined using the def a_function_name () style, but for the lambda function, we didn't name it at all. This is because the function of the lambda function is to perform some simple expression or operation without having to fully define the function.

The lambda function can take any number of arguments, but there can only be one expression.

X = lambda a, b: a * bprint (x (5,6)) # prints 30x = lambda a: ahem 3 + 3print (x (3)) # prints 12

The above is all the content of the article "what is the Lambda function in python?" Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Tags: Functions content articles expressions learning help functions parameters actual actually quantity easy to understand more organization style fundamentals knowledge editing industry information Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno MySQL Shulou Technology OPPO Reno Xiaomi Docker