mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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
1 changed files with 1 additions and 1 deletions
|
@ -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…
Reference in a new issue