import itertools

def fib():
  a, b = 0, 1
  while True:
      yield b
      a, b = b, a+b

print sum(itertools.takewhile(lambda x: x < 400, fib))
-----------------------
I tried the above; and it worked too (986)

Asokan Pichai
_______________________________________________
BangPypers mailing list
BangPypers@python.org
https://mail.python.org/mailman/listinfo/bangpypers

Reply via email to