input: Write a function to calculate an exponential series by summing the first n terms of the series with a given base x.
  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, 2) == 13
  assert exponential_series(1, 4) == 5
  assert exponential_series(0, 5) == 1
  assert exponential_series(5, 0) == 1
output: def exponential_series(x, n):
      sum = 0
      for i in range(n+1):
          sum += x ** i
      return sum