Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Compute Fibonacci First N
00:00
5 left

Compute Fibonacci First N

EasyPython

Problem

Write a function to compute the first n values of the fibonacci sequence.

Use the convention that the sequence begins with 0, 1, and return an empty list when n is zero. Implement def fibonacci(n):, where the integer input n produces a list containing exactly n integers.

Constraints

  • 0 <= n <= 1000
  • The output must contain exactly n integers
  • The sequence begins with 0, 1

Function Signature

def fibonacci(n):
Interviewer

Your question is Compute Fibonacci First N. Start with the requirements in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePython 3
You need to log in / sign up to run or submit.Ln 2
Run your code to see test output here.