← Prompts
Task / Fix Aider System Prompts

To make this change we need to modify `mathweb/flask/app.py`

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

Tags

Classification

Task Immediate work request to complete
Task Fix
Correct or validate
Scope Project
This codebase
Manual Manually placed / Persistent