MCPcopy Create free account
hub / github.com/ActiveState/code / first

Method first

recipes/Python/128711_Fibonacci_Object/recipe-128711.py:31–34  ·  view source on GitHub ↗

Returns a list with the first n Fibonacci numbers

(self, n)

Source from the content-addressed store, hash-verified

29 return [ self.nth(i) for i in range(k, n + 1) ]
30
31 def first(self, n):
32 """Returns a list with the first n Fibonacci numbers"""
33 g = self.generator(n)
34 return [ g.next() for i in range(n) ]
35
36 def unboundedGenerator(self):
37 """Unbounded Fibonacci generator"""

Callers 1

recipe-189060.pyFile · 0.45

Calls 3

generatorMethod · 0.95
rangeFunction · 0.85
nextMethod · 0.45

Tested by

no test coverage detected