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
# Fibonacci numbers, imperative style | |
# http://docs.python.org/2.7/tutorial/modules.html | |
def fibonacci(n, first = 0, second = 1): | |
for i in range(n): | |
yield first # Return current iteration | |
first, second = second, first + second | |
# Esto es programación funcional | |
print [ x for x in fibonacci(10) ] |
NewerOlder