Mercurial > hg > pyloader
comparison tests/objects.py @ 37:5268ab85fe1b
stub a fibonacci sequence for testing
author | Jeff Hammel <jhammel@mozilla.com> |
---|---|
date | Tue, 07 Jun 2011 19:14:04 -0700 |
parents | 362912842985 |
children | f6616a5f468f |
comparison
equal
deleted
inserted
replaced
36:362912842985 | 37:5268ab85fe1b |
---|---|
36 def wrap(app): | 36 def wrap(app): |
37 return Wrapper(app) | 37 return Wrapper(app) |
38 | 38 |
39 def fib(n): | 39 def fib(n): |
40 """return the nth fibonacci term""" | 40 """return the nth fibonacci term""" |
41 | 41 sequence = [1,1] |
42 while len(sequence) < n: | |
43 sequence.append(sequence[len(sequence)-1], sequence[len(sequence)-2]) | |
44 return sequence[n] |