Can python find fibonacci series in a single line of code?

Andrew Thompson andrew.thompson at ashecastle.com
Tue Nov 12 14:02:57 EST 2002


How about solving the series analytically...

map( lambda n:
5.0**-0.5*(((1+5**0.5)/2)**n-((1-5**0.5)/2)**n),range(1,99) )

Ok - tiny rounding errors -- but can remove those easily.




-----Original Message-----
From: python-list-admin at python.org [mailto:python-list-admin at python.org]
On Behalf Of sismex01 at hebmex.com
Sent: 12 November 2002 15:28
To: wganz at texoma.net; a_human_work at hotmail.com; python-list at python.org
Subject: RE: Can python find fibonacci series in a single line of code?


> From: Will Ganz [mailto:wganz at texoma.net]
> 

I didn't want to participate in this thread, but the main comment in
this note gave me pause.

> :> My Perl-addicted friend shows me that he can find
> :> fibanicci series in a single line of code.


As for your friend, ask him to cross a "one-liner"
equivalent of a bridge, some shoddy, barely-holding-together
piece of dubious engineering.  Software is the same thing,
and should be raised to the same standards of quality as
any other piece of engineering, but that's just my opinion.


> Perl is like some of the doctor's writing that I try to 
> decipher at the hospital. Great for writing prescriptions
> but invoke divine intervention to read more than a couple
> of sentences. In fact, doctors will ask nurses to interpret
> other doctor's writings to read the progress notes.*


Same thing here in Mexico; the most responsible doctors
I know either write their prescriptions out with a typewriter
or on a computer, or dictate them to their nurse or assistant,
whom invariably has much nicer writing.


> The same with Perl. One liners and anything less than 100
> lines you can do in Perl, but get Python for anything that
> you are going to have to maintain later. After having dealt
> with 15000 line Perl 'programs' with all global variables
> and documented solely by "self documenting variable names"
> (¿quick, what is the difference in $filedate, $FileDate, and 
> $Filedate?) Python is quite the relief to use.


The "author" of such a horror should be shot and forgotten,
for inflicting that kind of pain and cost on others.


> * estimated 45,00~>98,000 Americans die annually from 
>   medication errors v.s. 15,980 Americans murdered
>   in the year 2001


And I suppose, everywhere else in the world.

It seems like people, in this case doctors, really don't
understand that something as simple as writing out an
unreadable prescription is as life-threatening as any
disease.  Can this be grounds for a medical-negligence
suite?

-gustavo

-- 
http://mail.python.org/mailman/listinfo/python-list





More information about the Python-list mailing list