Commit 330742f9 authored by Michael Krause's avatar Michael Krause 🎉
Browse files

Add fibonacci values and sequences

parent 99522152
import math
def fibonacci(n):
"""return frist n elements of the fibonacci sequence with seeds 0 and 1"""
res = [0, 1]
for i in range(n-3):
res.append(res[-1] + res[-2])
return res
def fibonacci(n):
if n==0 or n==1:
return n
return fibonacci(n-1) + fibonacci(n-2)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment