input: Write a function to compute the moving average of time-series data points. The function should take two arguments: a list of data points and an integer representing the window size. It should return a list containing the moving average for each point in the original data points.
  assert moving_average([3, 5, 7, 2, 8, 10, 11, 65, 72, 81, 99, 100, 150], 3) == [3.0, 4.0, 5.0, 4.67, 5.67, 6.67, 7.67, 28.67, 49.33, 72.67, 84.33, 95.0, 115.67]
  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], 1) == [1.0, 1.0, 1.0]
  assert moving_average([], 3) == []
  assert moving_average([10, 20, 30, 40, 50], 5) == [10.0, 15.0, 20.0, 25.0, 30.0]
output: def moving_average(data, window_size):
      if not data:
          return []
      result = []
      for i in range(len(data)):
          start = max(0, i - window_size + 1)
          window = data[start:i + 1]
          result.append(sum(window) / len(window))
      return result