Skip to content

Commit 15651bd

Browse files
Allow only positive values of 'n'
1 parent 8682a38 commit 15651bd

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

recursive-fibonacci.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
def fib(n):
2-
if n <= 1:
2+
if n == 0 or n == 1:
33
return n
44
else:
55
return(fib(n-1) + fib(n-2))

0 commit comments

Comments
 (0)