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: 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 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: <55103C5D.4070305@davea.name> In-Reply-To: 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: 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 On 03/23/2015 12:59 PM, Chris Angelico wrote: > On Tue, Mar 24, 2015 at 3:16 AM, Dave Angel 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