input: Write a function to calculate an exponential series. The function should take two parameters: x (the base of the exponential series) and n (the number of terms to sum). The function should return the sum of the exponential series from term 0 to term n. If n is 0, the function should return 1 since the sum of the series with 0 terms is 1.
  assert exponential_series(2, 0) == 1
  assert exponential_series(2, 1) == 3
  assert exponential_series(2, 2) == 7
  assert exponential_series(2, 3) == 15
  assert exponential_series(3, 0) == 1
  assert exponential_series(3, 1) == 4
  assert exponential_series(3, 2) == 13
  assert exponential_series(3, 3) == 40
output: def exponential_series(x, n):
      if n == 0:
          return 1
      result = 0
      for i in range(n + 1):
          result += x ** i
      return result