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 authored and Takashi Kokubun committed 2019-08-05 09:04:32 +09:00
1 parent 253da5b219
commit 6bb3618f28
1 file changed
+1 -1
+1 -1
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