def main(): i = 1 total = 0 while fib(i) < 4000000: if fib(i) % 2 == 0: total += fib(i) i+=1 print total
def main(max_fib=30): if max_fib > 30: raise Exception for i in range(0, max_fib): print fib(i+90) print mean([0,2,4,5,6,7,5,9])
from itertools import ifilter from util import fib print sum(ifilter( lambda i: i % 2 == 0, fib(4 * (10 ** 6))))
#!/usr/bin/env python import util print(sum([x for x in util.fib(4000000) if x % 2 == 0]))
import util # from util import fib # from util import * from example.one.add import add util.fib(20) print(dir(util)) # 模块内定义的所有名称 # 包的结构 print(add(1, 2))
#!/usr/bin/env python import util for index, item in enumerate(util.fib(), start=1): if item >= 10**999: print(index) break