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