input: Write a function to compute the moving average of a list of time-series data points given a specified window size. If the window size exceeds the length of the data points, the function should return the average of the available elements up to the current index. The function should handle edge cases where the window size is larger than the data points.
  
  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]
  moving_average = moving_average(time_series, window)
  print(moving_average)
  
  assert moving_average([1, 2, 3, 4, 5], 3) == [1.0, 1.5, 2.0, 3.0, 4.0]
  assert moving_average([1, 2, 3, 4, 5], 5) == [1.0, 1.5, 2.0, 2.5, 3.0]
  assert moving_average([], 2) == []
  assert moving_average([1, 2, 3], 5) == [1.0, 1.5, 2.0]
output: 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