Python program to Get the Value of Fibonacci Element

x = abs(int(input("Choose the element to find its value: ")))
f1 = f2 =1
y = 2
while y < x:
 f1, f2 = f2, f1+f2
 y += 1
print("The value of the ",x," element is =", f2)

 

 

Output:

Choose the element to find its value: 12
The value of the  12  element is = 144

 

Choose the element to find its value: 8
The value of the  8  element is = 21

Subscribe For Daily Updates