input: Write a function to calculate the sum of an exponential series given a base x and the number of terms n. The series starts from x raised to the power of 0 up to x raised to the power of n. If the number of terms n is 0, the function should return the value 1.
  assert exponential_series(2, 3) == 15
  assert exponential_series(3, 2) == 13
  assert exponential_series(0, 5) == 1
  assert exponential_series(1, 10) == 11
  assert exponential_series(4, 0) == 1
output: def exponential_series(x, n):
      if n == 0:
          return 1
      total = 0
      for i in range(n + 1):
          total += x ** i
      return total