Anonymous Functions
Anonymous functions: A sentence function designed to address the simple requirements of functions
# this piece of code def Calc (n): return n**nprint(calc# to anonymous function lambda n:n** N Print (Calc (10))
Above is our analysis of this anonymous function of Calc, and here is a description of the anonymous function format
Lambda parameters: Return value # arguments can have multiple, separated by commas # Anonymous functions No matter how complex the logic, can only write one line, and the end of the logical execution of the content is the return value # The return value can be any data type as well as a normal function
As we can see, anonymous functions do not really have names.
There is no difference between the invocation of an anonymous function and a normal invocation. is the function name (parameter) can be.
Python (anonymous function)