From 5d0d7fa124e066c76a0ec8f7885813a759533cc1 Mon Sep 17 00:00:00 2001 From: rbatchu2 <112577508+rbatchu2@users.noreply.github.com> Date: Wed, 31 Aug 2022 15:30:28 -0400 Subject: [PATCH] Update fib.py fixed neg fib error --- fib.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fib.py b/fib.py index 421cfab..558d0e8 100644 --- a/fib.py +++ b/fib.py @@ -6,6 +6,8 @@ Negative numbers should return None """ def fibonacci(position): + if(position < 0): + return None if(position == 1 or position == 2): return 1 return fibonacci(position - 1) + fibonacci(position - 2)