To make this change we need to modify `mathweb/flask/app.py`: 1. Import the `math` module. 2. Replace the custom recursive `factorial()` helper with `math.factorial`. 3. Update `get_factorial()` to c
To make this change we need to modify `mathweb/flask/app.py`: 1. Import the `math` module. 2. Replace the custom recursive `factorial()` helper with `math.factorial`. 3. Update `get_factorial()` to call `math.factorial`. Here is the patch: *** Begin Patch *** Update File: mathweb/flask/app.py @@ -from flask import Flask - -from flask import Flask +from flask import Flask +import math @@ -def factorial(n): - "compute factorial" - - if n == 0: - return 1 - else: - return n * factorial(n-1) +def factorial(n): + "compute factorial" + + return math.factorial(n) @@ def get_factorial(self, n): - return str(factorial(n)) + return str(math.factorial(n)) *** End Patch