• + 0 comments

    Here's a quick way from fapello to implement the solution in Python:

    python Copy Edit import math

    Function to calculate e^x using a series expansion

    def calculate_exp(x, n_terms=100): result = 0 for i in range(n_terms): result += (x ** i) / math.factorial(i) return result

    Input reading

    t = int(input()) for _ in range(t): x = float(input()) print(f"{calculate_exp(x):.4f}") This computes 𝑒 𝑥 e x using the series expansion up to 100 terms, ensuring high accuracy within the tolerance limits provided.