Want to become a Vibe Coder? Join Vibe Coding Training here
x
C# Corner
Tech
News
Videos
Forums
Jobs
Books
Events
More
Interviews
Live
Learn
Training
Career
Members
Blogs
Challenges
Certification
Contribute
Article
Blog
Video
Ebook
Interview Question
Collapse
Feed
Dashboard
Wallet
Learn
Achievements
Network
Refer
Rewards
SharpGPT
Premium
Contribute
Article
Blog
Video
Ebook
Interview Question
Register
Login
Fibonacci Serious In Python
WhatsApp
Sr Karthiga
Aug 14
2016
868
0
0
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
Up Next
Fibonacci Serious In Python