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

1033 Views

See similar Python Mentoring tutors

Related Python Mentoring answers

All answers ▸

Write a function with arguments r, dr that will return a 2D array of size (r/dr, r/dr). In the array "draw" two circles and assign them a value of 1. Separate the two circles by adding a nan circle of equal width.


Ask the user for a number and output the smallest divisor, bigger than one, for the inputted number. Output "Prime" if the number is a prime number.


Why would I use dictionaries instead of a list?


Write a basic program to output the lowest of 3 input numbers. (You may omit error checks on your inputs)


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–2024

Terms & Conditions|Privacy Policy