Fibonacci-Zahlen durch Rekursion (ohne Currying)

This commit is contained in:
Martin Putzlocher 2022-04-25 16:58:43 +02:00
parent 7906360a15
commit cbe6432e1f

17
algorithmen/fibonacci.py Normal file
View File

@ -0,0 +1,17 @@
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)