diff --git a/fib.py b/fib.py index 50722c2..ae8977e 100644 --- a/fib.py +++ b/fib.py @@ -6,6 +6,10 @@ Negative numbers should return None """ def fibonacci(position): + if position < 0: + print("invalid input") + if position == 0: + return 0 if(position == 1 or position == 2): return 1 return fibonacci(position - 1) + fibonacci(position - 2)