Welcome to Foundation of Data Science Laboratory
Welcome to Foundation of Data Science Laboratory
Write a Python program to find the a Fibonaccie Series
With Function
def fibonacci_series(n):
# Initialize the first two terms
a, b = 0, 1
# Generate the Fibonacci series
for i in range(n):
print(a, end=" ")
a, b = b, a + b
# Input: number of terms in the Fibonacci series
n = int(input("Enter the number of terms: "))
# Call the function to print the Fibonacci series
print("Fibonacci series:")
fibonacci_series(n)