0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Pyhton_lambda式、無名関数

0
Posted at

lambdaは引数として関数を呼ぶもので使用すると便利。(mapとか)

lambda式で関数を表す

def 関数名(引数, 引数, ...):
    return 式

関数名 = lambda 引数, 引数, ...: 式

def square(x):
    return x * x

square(s(5))
> 25

これをlamdba式で表すと、

type(lambda x: x * x)
> function

s = lambda x: x * x
print(s(5))
> 25
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?