input: Write a function to calculate an exponential series based on the given input values of x and n. The function should return the sum of the series.
  assert exponential_series(2, 3) == 15
  assert exponential_series(1, 5) == 6
  assert exponential_series(0, 10) == 1
  assert exponential_series(3, 2) == 13
  assert exponential_series(-1, 4) == 0
output: def exponential_series(x, n):
      result = 0
      for i in range(n + 1):
          result += x ** i
      return result