forked from tdwojak/Python2017
Praca domowa nr 2
Rozwiązanie - Piotr Bystrzycki - nr indeksu 45146
This commit is contained in:
parent
233a2250f6
commit
c723ed6bb1
21
labs03/task03.py
Normal file
21
labs03/task03.py
Normal file
@ -0,0 +1,21 @@
|
||||
def Fibogen(n):
|
||||
if n == 0:
|
||||
yield 1
|
||||
if n == 1:
|
||||
yield 1
|
||||
yield 1
|
||||
if n >= 2 :
|
||||
i, j = 1, 1
|
||||
yield 1
|
||||
yield 1
|
||||
for k in range(2, n):
|
||||
f = i + j
|
||||
i = j
|
||||
j = f
|
||||
yield f
|
||||
|
||||
|
||||
for i in Fibogen(15):
|
||||
print(i)
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user