input: def exponential_series(x: float, n: int) -> float:
      """
      Calculate the sum of an exponential series given a base value x and the number of terms n.
      The series is calculated as the sum of x raised to the power of i for i from 0 to n.
  
      >>> exponential_series(2.0, 4)
      31.0
      >>> exponential_series(1.0, 3)
      4.0
      """
output:     result = 0.0
      for i in range(n + 1):
          result += x ** i
      return result