input: def exponential_series(x: float, n: int) -> float:
      """ Calculates the sum of the exponential series up to the nth term for a given value x.
      >>> exponential_series(1, 3)
      4
      >>> exponential_series(2, 4)
      31
      """
      sum = 0
      for i in range(n+1):
          sum += x ** i
      return sum
output:     sum = 0
      for i in range(n+1):
          sum += x ** i
      return sum