PythonMediumAlgorithms

Fibonacci Sequence

Write a function that returns the nth Fibonacci number. The sequence starts: 0, 1, 1, 2, 3, 5, 8, 13, 21...

Starter code

Python
def fibonacci(n):
    # Your code here
    pass

print(fibonacci(10))  # Should print: 55

Stuck on this challenge?

Let CodeForge AI help you find the solution.