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)

Answered by Finn G. Python tutor

1419 Views

See similar Python Mentoring tutors

Related Python Mentoring answers

All answers ▸

Why are negative indexes used?


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


Write a program that computes the sum of all numbers up to a input number n


Create an rock, paper, scissors game. The user should input one option, and the computer should play randomly.


We're here to help

contact us iconContact usWhatsapp logoMessage us on Whatsapptelephone icon+44 (0) 203 773 6020
Facebook logoInstagram logoLinkedIn logo

© MyTutorWeb Ltd 2013–2025

Terms & Conditions|Privacy Policy
Cookie Preferences