input: def exponential_series(x: float, n: int) -> float:
      """Calculate the sum of the first n terms in the exponential series for a given x.
      
      >>> exponential_series(2, 3)
      15.0
      >>> exponential_series(1, 4)
      5.0
      """
output:     result = 0.0
      for i in range(n):
          result += x ** i / math.factorial(i)
      return result