Lambda in Python
A lambda is a function that is declared and executed at the same time. It is an anonymous function.
#declare and run code, all at once (lambda input_param: code to run)(passed_params) #lambdas can be assigned to variables lambda_variable = (lambda inpu_param: code to run) #running an assigned lambda lambda_variable(passed_params)
Lambdas were made to take advantage of the ability to pass functions as parameters to first class functions.
add_three = (lambda x: x + 3) print (add_three(1)) #should print 4