Python program to Get Fibonacci Value Using Recursion

x = int(input("Choose a Fibonacci number to get its value: "))
def fibinacci(x):
 if x == 1 or x == 2:
    return 1
 return fibinacci(x-1) + fibinacci(x-2)
print(fibinacci(x))

 

 

 

Output:

Choose a Fibonacci number to get its value: 5
5

Choose a Fibonacci number to get its value: 11
89

 

Subscribe For Daily Updates

100+ Python Pattern Examplespython pattern examples - star patterns, number patterns