input: Write a function to calculate an exponential series for a given number x and a number of terms n. The function should sum the series 1 + x^1 + x^2 + ... + x^n. If the number of terms 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(1, 5) == 6
  assert exponential_series(3, 0) == 1
  assert exponential_series(0, 10) == 1
  assert exponential_series(4, 2) == 21
output: def exponential_series(x, n):
      sum = 0
      for i in range(n + 1):
          sum += x ** i
      return sum