All problems
Log Transform Feature
Problem
Apply the natural logarithm element-wise; inputs are assumed positive.
Empty input returns [].
Hint
Use math.log (base e), not log2 or log10.
Test cases
case 1
in: [[1,2.718281828459045,10]]
expected: [0,1,2.302585092994046]
case 2
in: [[0.5]]
expected: [-0.6931471805599453]
case 3
in: [[1,1]]
expected: [0,0]
case 4
in: [[]]
expected: []
Starter codePython
import math
def log_transform(values):
# Your code here
pass4 test cases · run your code against them in the editor