Editor settings

General settings

Save settings

Learn to program with Python

Find fibonacci sequence #

Write a function that takes a positive integer as input and returns a list of Fibonacci numbers that are less than or equal to the given number.

Fibonacci numbers are a sequence of numbers starting with 0 and 1 in which each number is the sum of the two preceding ones, e.g. 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...


Tests #

  • find_fibonacci(1) should return [0, 1, 1]
  • find_fibonacci(10) should return [0, 1, 1, 2, 3, 5, 8]
  • find_fibonacci(20) should return [0, 1, 1, 2, 3, 5, 8, 13]
  • find_fibonacci(100) should return [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
  • find_fibonacci(1000) should return [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987]
Output will be displayed here