input: def exponential_series(x: float, n: int) -> float:
      """Calculate the sum of the exponential series given by the formula: 1 + x + x^2 + ... + x^n.
      >>> exponential_series(2, 4)
      31.0
      >>> exponential_series(5, 2)
      31.0
      >>> exponential_series(1, 10)
      11.0
      """
output:     result = 0.0
      for i in range(n + 1):
          result += x ** i
      return result