START OF PREVIOUS DISCUSSION END OF PREVIOUS DISCUSSION
- User
START OF PREVIOUS DISCUSSION END OF PREVIOUS DISCUSSION user: make a pythons cript to print fibonnanci numbers
- Assistant
Sure, here's a simple Python script that generates and prints Fibonacci numbers:
pythondef fibonacci_sequence(n): """Generate and print the Fibonacci sequence up to the n-th term.""" fib_sequence = [0, 1] while len(fib_sequence) < n: # Generate the next Fibonacci number by adding the last two numbers next_number = fib_sequence[-1] + fib_sequence[-2] fib_sequence.append(next_number) return fib_sequence[:n] # Set the number of Fibonacci numbers you wish to generate number_of_terms = int(input("Enter how many terms of Fibonacci sequence you want: ")) # Generate and print the Fibonacci numbers fib_nums = fibonacci_sequence(number_of_terms) print(f"The first {number_of_terms} terms of the Fibonacci sequence are: {fib_nums}")
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.