python打印斐波那契序列代码
#!/usr/bin/env python a, b = 0, 1 print a for n in range(100): print b a, b = b, a+b
代码2
def fib(): a, b = 0, 1 while True: yield b a, b = b, a+b for i, n in zip(range(100), fib()): print i, n
python打印斐波那契序列代码
#!/usr/bin/env python a, b = 0, 1 print a for n in range(100): print b a, b = b, a+b
代码2
def fib(): a, b = 0, 1 while True: yield b a, b = b, a+b for i, n in zip(range(100), fib()): print i, n