shouldz

fibonacci via função recursiva

Jul 9th, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.13 KB | None | 0 0
  1. def fibrec (n):
  2. if n == 0:
  3. return 0
  4. elif n == 1:
  5. return 1
  6. else:
  7. return fibrec (n-1) + fibrec (n-2)
  8. print(fibrec(10))
Advertisement
Add Comment
Please, Sign In to add comment