input: Write a function to compute the moving average of time-series data points by sliding a window over the data and calculating the average for each subset of the window size. If the window size is 3, for example, compute the average of the first 3 numbers, then the average of the next 3 numbers, and so on. The function should handle cases where the window size is larger than the length of the data by returning an array of averages for the available subsets.
  
  def moving_average(data_points, window):
      moving_average = []
      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_average.append(average)
  
      return moving_average
  
  window = 3
  time_series = [3, 5, 7, 2, 8, 10, 11, 65, 72, 81, 99, 100, 150]
  assert moving_average(time_series, window) == [3.0, 4.0, 5.0, 4.333333333333333, 5.666666666666667, 6.666666666666667, 7.333333333333333, 28.666666666666668, 49.0, 72.66666666666667, 84.33333333333333, 93.33333333333333, 116.66666666666667]
output: def moving_average(data_points, window):
      moving_average = []
      for i in range(len(data_points)):
          start = max(0, i - window + 1)
          subset = data_points[start:i + 1]
          moving_average.append(sum(subset) / len(subset))
      return moving_average