DEV Community

Discussion on: Fibonacci without recursiveness in Python - a better way

Collapse
 
paddy3118 profile image
Paddy3118
  • You reuse name i in the for loop.
  • Since you know the total number of terms, you could create the whole array at the start, with the initial values followed by anything; then loop over an index to create next values without needing to append, which takes time.
Collapse
 
joaomcteixeira profile image
João M.C. Teixeira

Hi, thanks a lot for your comment. I updated the post in response. Let me know your thoughts. Cheers!

Collapse
 
joaomcteixeira profile image
João M.C. Teixeira

added more to the cause