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