#Python program to create a fibonacci series using recursion def fibonacci(n): if n <=1: return n else: return(fibonacci(n-1) + fibonacci(n-2)) # take input from the user no_of_terms = int(input("Enter number of terms! ")) # check if the number of terms is valid if no_of_terms <= 0: print("Plese enter a positive integer") else: print("Fibonacci sequence:") for i in range(no_of_terms): print (fibonacci(i))
Enter number of terms! 6 Fibonacci sequence: 0 1 1 2 3 5
Silan Software is one of the India's leading provider of offline & online training for Java, Python, AI (Machine Learning, Deep Learning), Data Science, Software Development & many more emerging Technologies.
We provide Academic Training || Industrial Training || Corporate Training || Internship || Java || Python || AI using Python || Data Science etc