In Python, write a recursive function that returns the first n Fibonacci numbers.

Begin by denoting the first and second Fibonacci number as 0 and 1 respectively. This helps us define a base case for our algorithm. We know that new Fibonacci numbers are formed by adding its 2 predecessors. This will help us define the recursive call.
Code:def Fibonacci(n): if n == 0: return 0 elif n == 1: return 1 else: return Fibonacci(n-1)+Fibonacci(n-2)

MS
Answered by Meer S. Computing tutor

1921 Views

See similar Computing A Level tutors

Related Computing A Level answers

All answers ▸

In a computer program, a parameter may be passed to a procedure by value. Explain how this method works.


A common construct found in many algorithms is a loop. Using pseudocode, write a pre-condition loop to output all of the even numbers between 99 and 201.


Describe Round Robin Scheduling


Describe what is meant by a modular design and state on advantage of a modular design.


We're here to help

contact us iconContact ustelephone icon+44 (0) 203 773 6020
Facebook logoInstagram logoLinkedIn logo

MyTutor is part of the IXL family of brands:

© 2026 by IXL Learning