Created
March 26, 2010 18:45
-
-
Save lvidarte/345231 to your computer and use it in GitHub Desktop.
fibonacci recursion 2
This file contains 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
#!/usr/bin/python | |
def fibo1(total=10): | |
a, b = 0, 1 | |
while total > 0: | |
print a | |
total = total - 1 | |
a, b = b, a + b | |
def fibo2(total=5, start=0): | |
a, b = 0, 1 | |
while total > 0: | |
if a >= start: | |
print a | |
total = total - 1 | |
a, b = b, a + b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment