code: def confine(x,low,high):
      '''Confine x to [low,high]. Values outside are set to low/high.
  See also restrict.'''
  
      y=x.copy()
      y[y < low] = low
      y[y > high] = high
      return f confine(x,low,high):
      '''Confine x to [low,high]. Values outside are set to low/high.
  See also restrict.'''
  
      y=x.copy()
      y[y < low] = low
      y[y > high] = high
      return y
docs: Confine x to [low,high]. Values outside are set to low/high.
  See also restrict.