Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Fibonacci Series Implementation
00:00
5 left

Fibonacci Series Implementation

EasyPython

Problem

Problem Statement

Ameriprise financial planning tools may need a short sequence of projected values for an illustrative calculation. Given a non-negative integer n, generate the first n terms of the Fibonacci series.

The sequence starts with F(0) = 0 and F(1) = 1. Each later term equals the sum of the previous two terms. Return the terms in a Python list, in order.

Formal Specification

Implement fibonacci_series(n).

  • Input: An integer n representing the number of terms to generate.
  • Output: A list containing exactly n Fibonacci terms.
  • If n is 0, return an empty list.

Constraints

  • 0 <= n <= 10^5
  • n is an integer
  • Return exactly n terms
  • Use F(0) = 0 and F(1) = 1

Function Signature

def fibonacci_series(n):
Interviewer

Your question is Fibonacci Series Implementation. 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.