File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 1- """
2- Factorial of a positive integer -- https://en.wikipedia.org/wiki/Factorial
1+ """Factorial of a non-negative integer.
2+
3+ For more information, see:
4+ https://en.wikipedia.org/wiki/Factorial
35"""
46
57
@@ -29,6 +31,7 @@ def factorial(number: int) -> int:
2931 raise ValueError ("factorial() only accepts integral values" )
3032 if number < 0 :
3133 raise ValueError ("factorial() not defined for negative values" )
34+
3235 value = 1
3336 for i in range (1 , number + 1 ):
3437 value *= i
@@ -37,7 +40,9 @@ def factorial(number: int) -> int:
3740
3841def factorial_recursive (n : int ) -> int :
3942 """
40- Calculate the factorial of a positive integer
43+ Calculate the factorial of a non-negative integer.
44+
45+ For more information, see:
4146 https://en.wikipedia.org/wiki/Factorial
4247
4348 >>> import math
@@ -65,4 +70,4 @@ def factorial_recursive(n: int) -> int:
6570 doctest .testmod ()
6671
6772 n = int (input ("Enter a positive integer: " ).strip () or 0 )
68- print (f"factorial{ n } is { factorial (n )} " )
73+ print (f"factorial( { n } ) is { factorial (n )} " )
You can’t perform that action at this time.
0 commit comments