Try to solve the coding problem according to the instructions and then click Update to test your results.

Return the correct value. Only the return value is evaluated.

Points: 10
Difficulty: Easy
Golf Strokes:
class Fibonacci(): def fib(self, n: int) -> int: # code goes here, return the correct value

Click 'Update' to run test results.


The Fibonacci sequence is present throughout the natural world. The sequence starts with 1,1,2,3,5,8,13 and continues to any given upper limit. Each new term in the Fibonacci sequence is generated by adding the previous two terms Create a program, which, given an index, returns the Fibonacci element at that sequence.

  • create a class called 'Fibonacci'
  • create a method 'fib' which takes the ordinal position of the element in the sequence
  • assume the 1st element of the array starts at 1
  • assume the value of that 1st element also begins at 1