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

Points: 10

Score:

Difficulty: Easy

Golf Strokes:
Try Code Here
class Fibonacci():
def fib(self, n: int) > int:
# code goes here, return the correct value
Info:
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
Sign up Try free for 15 days
Result