From 13902738fec902082dcf699a5943f71e9cc176d4 Mon Sep 17 00:00:00 2001 From: Tejasrahane <161036451+Tejasrahane@users.noreply.github.com> Date: Thu, 23 Oct 2025 10:37:17 +0530 Subject: [PATCH] Fix doctests in factorial_recursive function The doctests in factorial_recursive were calling factorial() instead of factorial_recursive(). This fix ensures that the tests correctly validate the factorial_recursive function itself. --- maths/factorial.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/maths/factorial.py b/maths/factorial.py index ba61447c7564..962ea75b9964 100644 --- a/maths/factorial.py +++ b/maths/factorial.py @@ -41,13 +41,13 @@ def factorial_recursive(n: int) -> int: https://en.wikipedia.org/wiki/Factorial >>> import math - >>> all(factorial(i) == math.factorial(i) for i in range(20)) + >>> all(factorial_recursive(i) == math.factorial(i) for i in range(20)) True - >>> factorial(0.1) + >>> factorial_recursive(0.1) Traceback (most recent call last): ... ValueError: factorial() only accepts integral values - >>> factorial(-1) + >>> factorial_recursive(-1) Traceback (most recent call last): ... ValueError: factorial() not defined for negative values