input: Write a function to calculate an exponential series.
  def exponential_series(x,n):
      sum = 0
      for i in range(n+1):
          sum += x ** i
      return sum
  assert exponential_series(2,4)==31
  assert exponential_series(3,3)==40
  assert exponential_series(4,0)==1
  assert exponential_series(1,10)==11
  assert exponential_series(5,1)==6
output: def exponential_series(x, n):
      sum = 0
      for i in range(n+1):
          sum += x ** i
      return sum