write me an amazing python script
- User
write me an amazing python script
- Assistant
Sure! Here's a simple Python script that generates a list of Fibonacci numbers up to a given number:
pythondef fibonacci(n): fib_sequence = [0, 1] while fib_sequence[-1] < n: fib_sequence.append(fib_sequence[-1] + fib_sequence[-2]) return fib_sequence[:-1] n = int(input("Enter a number: ")) fib_numbers = fibonacci(n) print(f"The Fibonacci numbers less than {n} are: {fib_numbers}")This script defines a function called
fibonaccithat takes an integernas input and returns a list of Fibonacci numbers that are less thann. The Fibonacci sequence is a series of numbers in which each number is the sum of the two preceding ones, usually starting with 0 and 1.The script then prompts the user to enter a number, converts it to an integer, and calls the
fibonaccifunction with the entered number as the argument. Finally, it prints out the Fibonacci numbers that are less than the entered number.I hope you find this script amazing! Let me know if you have any questions or if there's anything else I can help you with.
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.