You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fibonacci generator
def generate_fibonacci(n):
fibonacci_sequence = [0, 1]
while len(fibonacci_sequence) < n:
next_number = fibonacci_sequence[-1] + fibonacci_sequence[-2]
fibonacci_sequence.append(next_number)
return fibonacci_sequence[:n]
# Example usage:
n = int(input("Enter the number of Fibonacci numbers you want to generate: "))
fibonacci_numbers = generate_fibonacci(n)
print("Fibonacci sequence of length", n, ":", fibonacci_numbers)
#1
Open
Rohitsingh910 opened this issue
Apr 30, 2024
· 0 comments
No description provided.
The text was updated successfully, but these errors were encountered: