Skip to content
TheChatArchiveThe Chat Archive
gpt-4-1106-preview· openaiHugging Face Suzhen/CodeChat

START OF PREVIOUS DISCUSSION END OF PREVIOUS DISCUSSION

  1. User

    START OF PREVIOUS DISCUSSION END OF PREVIOUS DISCUSSION user: make a very simple script python code for fibo numbers

  2. Assistant

    Certainly! Below is a minimal Python script to generate Fibonacci numbers up to a count given by the user:

    def fibo(n):
        a, b = 0, 1
        fibo_sequence = []
        while len(fibo_sequence) < n:
            fibo_sequence.append(a)
            a, b = b, a + b
        return fibo_sequence
    
    count = int(input("How many Fibonacci numbers would you like to generate? "))
    fibonacci_numbers = fibo(count)
    print(fibonacci_numbers)
    

    When you run this script, it will prompt you to enter the number of Fibonacci numbers you would like to generate, and then it will print the sequence of Fibonacci numbers up to that count.