Informatik10/algorithmen/fibonacci.py

18 lines
244 B
Python

def fibo(n):
if n == 0:
return 0
elif n == 1:
return 1
elif n == 2:
return 1
else:
f1 = fibo(n-1)
f2 = fibo(n-2)
return f1 + f2
for i in range(30):
f = fibo(i)
print(f)