Skip to content

Commit 01f2921

Browse files
committed
Fibonacci
1 parent 35ee312 commit 01f2921

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

Roadmap/06 - RECURSIVIDAD/python/pguillo02.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,16 @@ def factorial(n, x =1):
1717
else:
1818
factorial(n-1, x*n)
1919

20-
factorial(4)
20+
factorial(4)
21+
22+
def fibonnacci(n):
23+
24+
if n == 1:
25+
return 1
26+
elif n == 2:
27+
return 1
28+
else:
29+
return fibonnacci(n-1) + fibonnacci(n-2)
30+
31+
print(fibonnacci(3))
32+

0 commit comments

Comments
 (0)