Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- arr = [1., 2., 3.]
- # 方法1: リスト内包表記を使う
- result = [math.log(x) for x in arr]
- # 方法2: mapする
- result = map(math.log, arr)
- # 方法3: 愚直にforループを使う
- result = []
- for x in arr:
- result.append(math.log(x))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement