First, built-in functions
Built-in functions in detail: http://www.runoob.com/python/python-built-in-functions.html
Second, anonymous function
An anonymous function is one that does not require an explicit function to be specified
# this piece of code def Calc (n):3 return n**nprint(calc)5 # Switch to anonymous function lambda n:n**nprint(Calc (10))
Characteristics:
1, Lambda is just an expression, function body is much simpler than def
2. The body of a lambda is an expression, not a block of code. Only a finite amount of logic can be encapsulated in a lambda expression.
3, call the small function without using the stack memory to increase operational efficiency.
Third, recursion
1, recursive call: Inside the function, you can call other functions. If you call itself directly or indirectly during a call to a function
#The final age of recursion.#Age (1) =age (2) +2#Age (2) =age (3) +2#Age (3) =age (4) +2#Age (4) =age (5) +2#Age (5) =18####Age (N) =age (n+1) +2 #n <5#Age (n) =18 #n =5#def Age (n):#if n = = 5:#return#return Age (n+1) +2###Print (age (1))
2. Characteristics of recursion
(1) must have a definite end condition
(2) Each time you enter a deeper level of recursion, the problem size should be reduced compared to the last recursion
(3) Recursive efficiency is not high
Python built-in functions, anonymous functions, recursive