Created
May 30, 2012 18:50
-
-
Save dmjio/2838259 to your computer and use it in GitHub Desktop.
fibonacci in python
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def fib(n): | |
#display fib numbers from 0 to n | |
a, b = 0, 1 | |
while b < n: | |
print b, | |
a, b = b, a + b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment