NICOLÁS BOTTARINI
Fibonacci

Fibonacci

Implement the famous Fibonacci sequence using TDD

Level:Novice
Duration:Short
Topics:
TDD

Instructions

The Fibonacci numbers (Fibonacci sequence), named after mathematician Fibonacci, are a sequence of numbers that looks like this:

0, 1, 1, 2, 3, 5, 8, 13,...

You start with the first two numbers, 0 and 1, and the next number in the sequence is always the sum of the previous two numbers. Fibonacci introduced it in 1202, in his book Liber Abaci.

So what will be your task? You should write a function fibonacci that takes one parameter steps and returns a number from the Fibonacci sequence, based on the parameter steps, which determines the position in the Fibonacci sequence.

For example, fibonacci(0) returns 0, fibonacci(4) returns 3, fibonacci(15) returns 610.