input: Write a function to calculate an exponential series. The function should take two parameters, x representing the base and n representing the number of terms in the series, and return the sum of the series. 
  
  assert exponential_series(2, 3)==15
  assert exponential_series(1, 4)==5
  assert exponential_series(3, 0)==1
  assert exponential_series(4, 2)==21
  assert exponential_series(0, 5)==1
output: def exponential_series(x, n):
      result = 0
      for i in range(n):
          result += x ** i
      return result