MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / fibonacci

Function fibonacci

Python/5 recusrion problems.py:18–23  ·  view source on GitHub ↗
(n)

Source from the content-addressed store, hash-verified

16# 2..TO PRINT FIBONACCI SERIES
17
18def fibonacci(n):
19 assert n>=0 and int(n)==n , "only positive integers"
20 if n==0 or n==1:
21 return n
22 else:
23 return fibonacci(n-1) + fibonacci(n-2)
24
25print(fibonacci(8))
26

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected