We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent c5d23b7 commit e1523a7Copy full SHA for e1523a7
factorial.py
@@ -8,23 +8,17 @@
8
9
def factorial(n):
10
11
- if n == 0 or n < 0:
+ outputCalc = 1
12
13
- outputCalc = 1
+ for number in range(1, n+1):
14
15
- else:
16
-
17
18
19
- for number in range(1, n+1):
20
21
- outputCalc = number * outputCalc
+ outputCalc = number * outputCalc
22
23
return outputCalc
24
25
26
def test_factorial():
27
- assert factorial(1) == 1
+ assert factorial(2) == 1
28
assert factorial(0) == 1
29
assert factorial(-10) == 1
30
0 commit comments