2019-07-28から1日間の記事一覧
名前をつけない関数を以下のようなコードで書くことができる。 lambda x: x*2これと組み込み関数map()を用いることで、リストの要素すべてに変更を加えることができる。 list_input = [1, 2, 3] list_output = list(map(lambda x: x*2, list_input))【参考】…
名前をつけない関数を以下のようなコードで書くことができる。 lambda x: x*2これと組み込み関数map()を用いることで、リストの要素すべてに変更を加えることができる。 list_input = [1, 2, 3] list_output = list(map(lambda x: x*2, list_input))【参考】…