def map(x, in_min, in_max, out_min, out_max):
  """Maps a number from one range to another.
  
  Arguments:
    x {number} -- The number to map.
    in_min {number} -- The min of the first range.
    in_max {number} -- The max of the first range.
    out_min {number} -- The min of the new range.
    out_max {number} -- The max of the new range.
  
  Returns:
    number -- The mapped number.
  """

  return (x - in_min) * (out_max - out_min) / (in_max - in_min) + out_min