The workspace contains a partially broken implementation at /app/starter_code.py. Your task is to fix the bugs and complete the implementation to satisfy the tests.
Task: Implement a Python package named example2 with a submodule math that provides two functions required by the tests.
Requirements
Package structure:
example2/init.py should import and expose the submodule math so that tests can call e2.math.
example2/math.py should define the functions below.
Function one:
Signature: one(x)
Behavior: always return 1.0 as a float, regardless of the input.
Should be usable as e2.math.one(1) and return 1.0.
Function pi:
Signature: pi(n)
Behavior: return a Monte Carlo estimate of pi using NumPy's global RNG (so that numpy.random.seed(...) affects it).
Implementation details:
Validate input: n must be a positive integer; raise ValueError otherwise.
Generate n random points uniformly in the unit square [0, 1] × [0, 1] using np.random.rand(n, 2).
Count how many points lie inside the unit circle quarter: x^2 + y^2 <= 1.0.
Estimate pi as 4.0 * inside / n and return it as a Python float.
The test scenario:
After setting numpy.random.seed(0), pi(500000) should return a value within 0.01 of 3.14159 (i.e., approximately 3.13159–3.15159 range).
Documentation and robustness:
Include docstrings for both functions.
Ensure the implementation is straightforward, efficient for large n, and relies only on numpy.
Expected behavior
e2.math.one(1) -> 1.0
With numpy.random.seed(0); e2.math.pi(500000) -> approximately 3.14159 within 0.01.