From 84e9b8a8c96654aef693c03b035a8908f8ec0b91 Mon Sep 17 00:00:00 2001 From: MelodyZhangYiqun Date: Wed, 31 Aug 2022 12:59:43 -0400 Subject: [PATCH] negative issue resolved --- fib.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/fib.py b/fib.py index 421cfab..7a0ab37 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)