Write a recursive function to return the nth Fibonacci number in Python

def fibonacci(n): if n <= 1: return n else: return fibonacci(n-1) + fibonacci(n-2)

FG
Answered by Finn G. Python tutor

1909 Views

See similar Python Mentoring tutors

Related Python Mentoring answers

All answers ▸

How might we implement the bubble sort algorithm in Python


Write a simple number guessing game, give the user 3 tries to guess a number between 1 and 10


Create a program that checks for syntactical errors in an email address.


What is the difference between a for loop and a while loop.


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