Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

fibonacci python

def fib(n: int) -> int:
	if n in {0,1}:
    	return n
	a,b = 0,1
	for i in range(n-1):
    	a,b = b,a+b
        
	return b
Source by docs.python.org #
 
PREVIOUS NEXT
Tagged: #fibonacci #python
ADD COMMENT
Topic
Name
1+7 =