smithy1208

fib_with_list

Feb 15th, 2021 (edited)
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.21 KB | None | 0 0
  1. def fib(n):
  2.     r = []
  3.     for i in range(n):
  4.         if i < 2:
  5.             r.append(1)
  6.         else:
  7.             r.append(r[i - 2] + r[i - 1])
  8.     return r
  9.  
  10.  
  11. if __name__ == "__main__":
  12.     print(fib(100))
Add Comment
Please, Sign In to add comment