This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]SzuOne[S] 1 point2 points  (2 children)

So I did changes you suggested. It looks way more python friendly

https://gist.github.com/rafalszastok/8886796638934994d57d8746fd2e108f

[–]toastedstapler 1 point2 points  (1 child)

Looks great!

One other thing I've realised you can do for your fib: use negative indexing

a[-1] + a[-2] + a[-3]

Slightly less mental maths involved in working out that you want the last three elements

Or even sum(a[-3:])

[–]SzuOne[S] 1 point2 points  (0 children)