input: Write a function to calculate an exponential series. The function should take two parameters, `x` (the base) and `n` (the number of terms), and return the sum of the exponential series up to the nth term. If `n` is 0, the function should return 1.
  
  def exponential_series(x, n):
      sum = 0
      for i in range(n + 1):
          sum += x ** i
      return sum
  
  assert exponential_series(2, 3) == 15
  assert exponential_series(3, 3) == 40
  assert exponential_series(0, 5) == 1
  assert exponential_series(1, 10) == 11
  assert exponential_series(-1, 4) == 0.9375
output: def exponential_series(x, n):
      sum = 0
      for i in range(n + 1):
          sum += x ** i
      return sum