Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #87855 > unrolled thread
| Started by | Chris Angelico <rosuav@gmail.com> |
|---|---|
| First post | 2015-03-24 11:27 +1100 |
| Last post | 2015-03-24 20:54 +1300 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.lang.python
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
Re: fibonacci series what Iam is missing ? Chris Angelico <rosuav@gmail.com> - 2015-03-24 11:27 +1100
Re: fibonacci series what Iam is missing ? Gregory Ewing <greg.ewing@canterbury.ac.nz> - 2015-03-24 20:54 +1300
| From | Chris Angelico <rosuav@gmail.com> |
|---|---|
| Date | 2015-03-24 11:27 +1100 |
| Subject | Re: fibonacci series what Iam is missing ? |
| Message-ID | <mailman.87.1427156876.10327.python-list@python.org> |
On Tue, Mar 24, 2015 at 11:09 AM, Dave Angel <d@davea.name> wrote: > Repeat to self: comment first, then write test, then write the code. > > Reply to self: Maybe next time. Commenting is like dieting. You can always start tomorrow. ChrisA
[toc] | [next] | [standalone]
| From | Gregory Ewing <greg.ewing@canterbury.ac.nz> |
|---|---|
| Date | 2015-03-24 20:54 +1300 |
| Message-ID | <cncji4F35ulU1@mid.individual.net> |
| In reply to | #87855 |
Chris Angelico wrote:
> Commenting is like dieting. You can always start tomorrow.
I've been meaning to become a procrastinator, but
I think I'll start tomorrow.
In the meantime, since we seem to be having a
fibbing competition, here's my contribution, that
uses neither recursion nor (explicit) iteration:
from numpy import array, dot
a = array([[0,1],[1,1]])
b = array([0,1])
def fib(n):
return reduce(dot,[a]*n+[b])[1]
for i in range(10):
print(fib(i))
--
Greg
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web