Lambda
francnstein
Posted on May 15, 2020
Lambda functions aren't as powerful as named functions.
They can only do things that require a single expression - usually equivalent to a single line of code.
named function
def polynomial(x):
return x**2 + 5*x + 4
print(polynomial(-4))
lambda
print((lambda x: x**2 + 5*x + 4) (-4))
0
0
๐ ๐ช ๐
๐ฉ
francnstein
Posted on May 15, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.
Related
computerscience State Machines in Practice: Implementing Solutions for Real Challenges
March 18, 2024