[Chicago] Python Tutorial 4.6 function fib()

Scott Zibble zibble at gmail.com
Sun Jan 6 22:29:16 CET 2008

```I think part of the reason this may be complex for some people is because it
doesn't come back to the concept if idealized bees.  I'm pretty sure that's
why McAvoy hasn't responded in this thread yet.

>From Wikipedia:

Fibonacci numbers also appear in the description of the reproduction of a
population of idealized bees, according to the following rules:

- If an egg is laid by an unmated female, it hatches a male.
- If, however, an egg was fertilized by a male, it hatches a female.

Thus, a male bee will always have one parent, and a female bee will have
two.

If one traces the ancestry of any male bee (1 bee), he has 1 female parent
(1 bee). This female had 2 parents, a male and a female (2 bees). The female
had two parents, a male and a female, and the male had one female (3 bees).
Those two females each had two parents, and the male had one (5 bees). This
sequence of numbers of parents is the Fibonacci
sequence.[23]<http://en.wikipedia.org/wiki/Fibonacci_number#_note-22>

This is an idealization that does not describe *actual* bee ancestries. In
reality, some ancestors of a particular bee will always be sisters or
brothers, thus breaking the lineage of distinct parents.

On Jan 6, 2008 3:10 PM, Jon Sudlow <jsudlow at gmail.com> wrote:

> Like I said, their are slicker solutions like recursion. Nice fib in five
> lines.The next time someone asks me  about  a fib sequence I'll be fully
>
> Thanks,
> Jon
>
>
> On Jan 6, 2008 10:26 AM, sheila miguez < shekay at pobox.com> wrote:
>
> > On Jan 5, 2008 10:47 PM, Patrick O'Hara < pohara at virtualmotors.com>
> > wrote:
> > > uh you did not answer the question
> > > why did the def fib(n):
> > > fail to work
> > > on python
> > > or my MacBookPro w/ Leopard
> >
> >
> >
> > what you typed here is wrong
> > > >    a,b = b, a*b
> >
> > Ted corrected it
> > >    a,b = b, a+b
> >
> > So, the reason the function you typed from the tutorial didn't work is
> > that you didn't type it correctly.
> >
> >
> > http://docs.python.org/tut/node6.html#SECTION006600000000000000000
> >
> >
> >
> > --
> > sheila
> > _______________________________________________
> > Chicago mailing list
> > Chicago at python.org
> > http://mail.python.org/mailman/listinfo/chicago
> >
>
>
>
> --
> Jon Sudlow
> 3225 Foster Avenue
> 221 Sohlberg Hall
> C.P.O 2224
> Chicago, Il  60625
>
> _______________________________________________
> Chicago mailing list
> Chicago at python.org
> http://mail.python.org/mailman/listinfo/chicago
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/chicago/attachments/20080106/675b354d/attachment.htm
```