Joined December 2012
·

Antonio Vera

Santiago de Chile
·
·
·

Posted to Pretty Print JSON in the Terminal over 1 year ago

It just works! Thanks!

BTW, do you know such a neat one-liner which also adds syntax highlighting?

Posted to Index of minimum element of a list over 1 year ago

Sure. It means that, by default, Python considers that tuple (a,b) is less than or equal than (a',b') if and only if a is less than a' or if a equals a' and b is less than or equal than b'.

In symbols: (a,b) <= (a',b') if and only if a < a' or ( a == a' and b <= b' ).

I'll link the term 'lexicographical order' to the Wikipedia article in my protip. Thanks!

Posted to A Better Fibonacci over 1 year ago

Hi Jared,
nice to show this in Coderwall.

BTW, you can do better: from some point on, the formula is still simpler since (1-phi)^n/sqrt(5) becomes strictly less than 0.5 in absolute value, and from that point on you can compute F_n as the nearest integer to phi^n/sqrt(5), i.e., using the round function instead of floor. This is true because the original formula yields an integer.

Achievements
149 Karma
27,966 Total ProTip Views