Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #87840

Re: fibonacci series what Iam is missing ?

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed1a.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <davea@davea.name>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.100
X-Spam-Evidence '*H*': 0.80; '*S*': 0.00; 'assignment': 0.07; 'intermediate': 0.07; 'subject:missing': 0.07; 'assumed': 0.09; 'calculating': 0.09; '12:59': 0.16; '24,': 0.16; 'caching': 0.16; 'non-trivial': 0.16; 'subject: ?': 0.16; 'wrote:': 0.18; 'separate': 0.22; 'print': 0.22; 'header:User-Agent:1': 0.23; 'question': 0.24; 'least': 0.26; 'values': 0.27; 'header:In-Reply- To:1': 0.27; 'function': 0.29; 'chris': 0.29; 'am,': 0.29; 'along.': 0.31; 'subject:what': 0.31; 'values.': 0.31; 'entirely': 0.33; 'comment': 0.34; 'could': 0.34; 'but': 0.35; 'sequence': 0.36; 'example,': 0.37; 'performance': 0.37; 'step': 0.37; 'to:addr:python-list': 0.38; 'list,': 0.38; 'pm,': 0.38; 'rather': 0.38; 'to:addr:python.org': 0.39; 'even': 0.60; 'dave': 0.60; 'number,': 0.60; 'numbers': 0.61; 'back': 0.62; 'save': 0.62; "you've": 0.63; 'soon': 0.63; 'charset:windows-1252': 0.65; 'mar': 0.68; 'received:74.208': 0.68; 'gain': 0.79; 'potentially': 0.81; '2015': 0.84; 'angel': 0.91; 'capture': 0.91; 'fibonacci': 0.91
Date Mon, 23 Mar 2015 14:07:50 -0400
From Dave Angel <davea@davea.name>
User-Agent Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0
MIME-Version 1.0
To python-list@python.org
Subject Re: fibonacci series what Iam is missing ?
References <CACT3xuVF-MOVQK5wSorRSAfpAQEXvS7QsqarACVZKXsQ0bxzpQ@mail.gmail.com> <55103C5D.4070305@davea.name> <CAPTjJmr6rN84BXqsAyhSN1x-SHA+6htGCeu6F=NTJjk6nHxAFQ@mail.gmail.com>
In-Reply-To <CAPTjJmr6rN84BXqsAyhSN1x-SHA+6htGCeu6F=NTJjk6nHxAFQ@mail.gmail.com>
Content-Type text/plain; charset=windows-1252; format=flowed
Content-Transfer-Encoding 7bit
X-Provags-ID V03:K0:MJ4xpLmcX/lWKl+o7lhHXhO4sBAPueqqMk2ZSkkI/BL/g0njPye alT4UY/qpTG+XqX9PKH83+08+2UAvCFcGt5KhpogWcZXpVX6I3qM20TQkX803C0FkULA20+ 9L312z/CJe1bAcToJRUHroh4eYINr61EixgrVrrS70t80cZDbMi1pJ9DPUVYZLE1k7wLVgV 9yMPFAxxFxvPa9gz4ADtQ==
X-UI-Out-Filterresults notjunk:1;
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.19
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.77.1427134087.10327.python-list@python.org> (permalink)
Lines 28
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1427134087 news.xs4all.nl 2915 [2001:888:2000:d::a6]:36575
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:87840

Show key headers only | View raw


On 03/23/2015 12:59 PM, Chris Angelico wrote:
> On Tue, Mar 24, 2015 at 3:16 AM, Dave Angel <davea@davea.name> wrote:
>> An entirely separate question is whether you can gain performance by caching
>> intermediate values.  For example, if you capture values in a list, you
>> could potentially save a lot of time, at least for non-trivial values of n.
>
> If you take a step back and seek to print a sequence of Fibonacci
> numbers, rather than calculating specific ones based on their indices,
> then you don't even need to consider caching. As soon as you've
> printed out a number, you move right along.
>

But that's a big assumption.  I assumed the comment on the function had 
a reasaonable meaning, that the OP assignment was to learn about recursion.

If I were the instructor, I might have assigned them to print the 
fibonacci numbers backwards:

5  5
4  3
3  2
2  1
1  1
0  0


-- 
DaveA

Back to comp.lang.python | Previous | Next | Find similar | Unroll thread


Thread

Re: fibonacci series what Iam is missing ? Dave Angel <davea@davea.name> - 2015-03-23 14:07 -0400

csiph-web