Python2017/labs03/task02.py

14 lines
204 B
Python
Raw Normal View History

2017-12-09 23:16:43 +01:00
#!/usr/bin/env python2
# -*- coding: utf-8 -*-
def fibonacci(n):
fn = [0, 1,]
for i in range(2, n):
fn.append(fn[i-1] + fn[i-2])
yield fn
a = fibonacci(10)
for i in a:
print(i)