1
0
Fork 0
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:
Yaw Boakye 2018-10-12 02:04:46 +02:00 committed by Takashi Kokubun
parent 253da5b219
commit 6bb3618f28
No known key found for this signature in database
GPG key ID: 6FFC433B12EE23DD

View file

@ -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