#File: Fibonacci.py
#A simple program to generate Fibonacci series
def main():
print "Fibonacci Series"
n = input("Enter the value of n, number of terms:")
x = n
def fibo(n):
if n == 0 or n == 1:
return 1
else:
return fibo(n-1)+fibo(n-2)
for i in range(x+1):
print fibo(i)
main()
#A simple program to generate Fibonacci series
def main():
print "Fibonacci Series"
n = input("Enter the value of n, number of terms:")
x = n
def fibo(n):
if n == 0 or n == 1:
return 1
else:
return fibo(n-1)+fibo(n-2)
for i in range(x+1):
print fibo(i)
main()
Nice Post.
ReplyDeletePython Online Training