TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
C# Corner
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Fibonacci Serious In Python
Sr Karthiga
Aug 14
2016
Code
823
0
0
facebook
twitter
linkedIn
Reddit
WhatsApp
Email
Bookmark
expand
fibo.zip
def recur_fibo(n):
""
"Recursive function to
print Fibonacci sequence
""
"
if
n <= 1:
return
n
else
:
return
(recur_fibo(n-1) + recur_fibo(n-2))
# take input from the user
nterms =
int
(input(
"How many terms? "
))
# check if the number of terms is valid
if
nterms <= 0:
print(
"Plese enter a positive integer"
)
else
:
print(
"Fibonacci sequence:"
)
for
i in range(nterms):
print(recur_fibo(i))
Fibonacci serious
Python