0
How do i find the length of the number after getting the result of fibonacci series?
I have printed the numbers in fibonacci upto the number I have entered . I have got the result . Now I want to know how many number are printed in the result. How do I do that .
2 Answers
+ 3
Medit Mercy what you do is change the final output into a string then you get the length of the string like so
x = str(t2)
y = len(x)
print(y)
https://code.sololearn.com/cMx8bi3LvteZ/?ref=app
+ 1
def fibo(n):
if n==0:
return 0
elif n==1:
return 1
else:
return (fibo(n-2)+fibo(n-1))
n=int(input(""))#Enter the steps
c=0
for i in range(n):
a=fibo(i)
c+=1
print(a)
print("no.of steps printed:",c)