How to generate the Fibonacci Sequence using python

def fibonacci(n): if n

Created By :

Created On :

23-03-2024

How to generate the Fibonacci Sequence using python

Updated on 24, February 2024 293 Enrolled
how to

Step 2

def fibonacci(n):

if n <= 1:

return n

else:

return fibonacci(n - 1) + fibonacci(n - 2)

terms = int(input("Enter the number of terms: ")) print("Fibonacci sequence:")

for i in range(terms):

print(fibonacci(i))

line

Copyrights © 2024 letsupdateskills All rights reserved