n+1 to include n in range
Python's range stop right before n, which means factL never returns the correct result. Closes: https://github.com/ruby/ruby/pull/1982
This commit is contained in:
parent
253da5b219
commit
6bb3618f28
@ -3,7 +3,7 @@
|
||||
|
||||
def factL(n):
|
||||
r = 1
|
||||
for x in range(2, n):
|
||||
for x in range(2, n+1):
|
||||
r *= x
|
||||
return r
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user