input: def exponential_series(x: float, n: int) -> float:
      """ Calculate the sum of the exponential series up to the nth term for a given base x.
      >>> exponential_series(2, 4)
      31.0
      >>> exponential_series(3, 3)
      40.0
      """
output:     result = 0.0
      for i in range(n):
          result += x ** i
      return result