import sys


def fib(number):
    if not number:
        return 0
    if number == 1:
        return 1
    return fib(number - 1) + fib(number - 2)


if __name__ == '__main__':
    inputfile = sys.argv[1]
    with open(inputfile, 'r') as f:
        for line in f:
            if line:
                print '{}'.format(fib(int(line.strip())))

@@ -14,138 +14,244 @@
 def 
+gen
 fib(
-number
 ):%0A    
-if not number:%0A        return 0%0A    if number == 1:%0A        return 1%0A    return fib(number - 1) + fib(number - 2)
+first, second = 0, 1%0A    while True:%0A        yield first%0A        first, second = second, first + second%0A%0A%0Adef fib(number):%0A    fibs = genfib()%0A    for i in xrange(number + 1):%0A        retval = fibs.next()%0A    return retval
 %0A%0A%0Ai

Implement generator based fib function