Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Fibonacci
#7
(May-15-2021, 02:07 PM)jefsummers Wrote: Think about your logic as well. Your method of creating the list calculates the entire list up to n each time through the loop. So, to get a list of 10 values you generate the list to 3, list to 4, list to 5, etc. Not explaining this well, but if you put a
print('in loop')
after line 9 you will see what I mean. An efficient algorithm would only do this 8 times (excludes the first 2 entries).

Hi Jefsummers,

thank you for your comment! Thanks to that, I understood what was wrong.

Cheers,
Yasunaga
Reply


Messages In This Thread
Fibonacci - by Yasunaga - May-15-2021, 11:15 AM
RE: Fibonacci - by Yoriz - May-15-2021, 11:51 AM
RE: Fibonacci - by Yasunaga - May-15-2021, 02:00 PM
RE: Fibonacci - by snippsat - May-15-2021, 01:49 PM
RE: Fibonacci - by jefsummers - May-15-2021, 02:07 PM
RE: Fibonacci - by Yasunaga - May-16-2021, 02:26 AM
RE: Fibonacci - by jefsummers - May-15-2021, 02:08 PM
RE: Fibonacci - by csr - May-16-2021, 02:36 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  fibonacci ***Time limit exceeded*** frequency 18 10,626 Nov-29-2018, 09:03 PM
Last Post: frequency
  Fibonacci sequence Darbandiman123 2 2,777 Sep-26-2018, 02:32 PM
Last Post: Darbandiman123
  Help debug my fibonacci implementation dineshpabbi10 6 4,142 May-16-2018, 12:12 PM
Last Post: dineshpabbi10
  Fibonacci Sequence on Turtle JRod 9 12,725 Feb-06-2017, 01:24 PM
Last Post: JRod

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020