input: Write a function to compute the moving average of time-series data points given a window size. The function should take a list of data points and an integer window size as input and return a list of moving averages for each data point.
  
  def moving_average(data_points, window):
      moving_averages = []
      for index in range(len(data_points)):
          start = 0 if index - window + 1 < 0 else index - window + 1
          window_data = data_points[start:index + 1]
          average = sum(window_data) / len(window_data)
          moving_averages.append(average)
      return moving_averages
  
  assert moving_average([3, 5, 7, 2, 8, 10, 11, 65, 72, 81, 99, 100, 150], 3) == [3.0, 4.0, 5.0, 4.666666666666667, 7.333333333333333, 10.0, 13.666666666666666, 38.666666666666664, 71.0, 86.33333333333333, 99.0, 106.0, 123.0]
  assert moving_average([1, 2, 3, 4, 5], 2) == [1.0, 1.5, 2.5, 3.5, 4.5]
  assert moving_average([1], 1) == [1.0]
  assert moving_average([], 3) == []
output: def moving_average(data_points, window):
      moving_averages = []
      for index in range(len(data_points)):
          start = 0 if index - window + 1 < 0 else index - window + 1
          window_data = data_points[start:index + 1]
          average = sum(window_data) / len(window_data)
          moving_averages.append(average)
      return moving_averages