From cd870074164bab8f0017ea2a0cbdf3964f2466f0 Mon Sep 17 00:00:00 2001 From: alolika bhowmik <152315710+alo7lika@users.noreply.github.com> Date: Wed, 19 Mar 2025 22:03:24 +0530 Subject: [PATCH] Update fixme.py --- fixme.py | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/fixme.py b/fixme.py index bed76dd..395ccaa 100644 --- a/fixme.py +++ b/fixme.py @@ -1,13 +1,15 @@ def fibonacci_iterative(n): if n <= 0: - return 0 - elif n == 2: #Fix me - return 1 - + return None + elif n == 1: + return 0 + elif n == 2: + return 1 + a, b = 0, 1 - for _ in range(2, n+1): + for _ in range(2, n): a, b = b, a + b - return b # Fix me. + return b n = 10 -print(f"The {n}th Fibonacci number is: {fibonacci_iterative(n)}") \ No newline at end of file +print(f"The {n}th Fibonacci number is: {fibonacci_iterative(n)}")