ultimatepp/bazaar/BoostPyTest/fibo.py
kohait 478f0a675f bazaar: BoostPyTest: invoke py scripts from outside and access upp from inside py scripts
git-svn-id: svn://ultimatepp.org/upp/trunk@3430 f0d560ea-af0d-0410-9eb7-867de7ffcac7
2011-05-17 12:31:02 +00:00

15 lines
325 B
Python

# Fibonacci numbers module
def fib(n): # write Fibonacci series up to n
a, b = 0, 1
while b < n:
print b,
a, b = b, a+b
def fib2(n): # return Fibonacci series up to n
result = []
a, b = 0, 1
while b < n:
result.append(b)
a, b = b, a+b
return result