Advertisement
George_Ivanov05

fib

Jun 14th, 2022
846
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.17 KB | None | 0 0
  1. def fibonacci(n):
  2.     if n == 0:
  3.         return 0
  4.     if n == 1:
  5.         return 1
  6.     return fibonacci(n - 1) + fibonacci(n - 2)
  7.  
  8.  
  9. print([fibonacci(i) for i in range(5)])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement