I went through Beginning Python fibonacci generator
How to write with out stop number where we want to stop.
My Code of FIbnocci is below
def Fibonnaci(n):
if n == 0:
return 0
if n == 1:
return 1
else:
return (Fibonnaci(n-1)+ Fibonnaci(n-2))
n = int(input())
print(Fibonnaci(n))
I wrote with yield statement but its infinite loop running
def fib(n):
a, b = 0, 1
while True:
yield a
a, b = b, a + b
fib(7)
Desired out > 13