Advertisement
Guest User

Untitled

a guest
Jun 20th, 2019
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. import math
  2.  
  3. arr = [1., 2., 3.]
  4.  
  5. # 方法1: リスト内包表記を使う
  6. result = [math.log(x) for x in arr]
  7.  
  8. # 方法2: mapする
  9. result = map(math.log, arr)
  10.  
  11. # 方法3: 愚直にforループを使う
  12. result = []
  13. for x in arr:
  14. result.append(math.log(x))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement