input: Write a function to calculate an exponential series. The function should take two parameters, x and n, where x represents the base and n represents the number of terms in the series. Return the sum of the terms in the exponential series. If the given n is 0 then return x.
  assert exponential_series(2, 3)==15
  assert exponential_series(1, 10)==11
  assert exponential_series(0, 5)==0
  assert exponential_series(3, 0)==3
output: def exponential_series(x, n):
      if n == 0:
          return x
      result = 0
      for i in range(n):
          result += x ** i
      return result