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

1938 Views

See similar Python Mentoring tutors

Related Python Mentoring answers

All answers ▸

Print "Hello World!" ten times without typing (or pasting) the print function more than once


Explain why creating a list of several instances of one element using something like my_list = [a] * 5 can result in strange behaviour


Write a Python script to take a product name as input and then automatically google search reviews for it and open the top 3 search results in different tabs


Explain the difference between local and global variables


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