francnstein

francnstein

Posted on May 15, 2020

Lambda

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
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

ยฉ TheLazy.dev

About