From 6bb3618f281e1cdbb28fe38ee88287da9b1838e8 Mon Sep 17 00:00:00 2001 From: Yaw Boakye Date: Fri, 12 Oct 2018 02:04:46 +0200 Subject: 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 --- benchmark/other-lang/fact.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'benchmark') diff --git a/benchmark/other-lang/fact.py b/benchmark/other-lang/fact.py index 01593965d9..1ce9f76275 100644 --- a/benchmark/other-lang/fact.py +++ b/benchmark/other-lang/fact.py @@ -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 -- cgit v1.2.3