Skip to content
DeepForgeby svx
All problems

Observation Clipping

Problem

Clip each observation element into its own [low[i], high[i]] range and return the new list.

Hint

Clipping observations protects against rare out-of-range sensor readings.

Test cases

case 1
in: [[5,-5],[-1,-1],[1,1]]
expected: [1,-1]
case 2
in: [[0.5,0.5],[0,0],[1,1]]
expected: [0.5,0.5]
case 3
in: [[],[],[]]
expected: []
Starter codePython
def clip_observation(observation, low, high):
    # Your code here
    pass

3 test cases · run your code against them in the editor