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: hi, make a short python script for fibo numbers

  2. Assistant

    Certainly! Here's a short Python script that generates Fibonacci numbers up to the nth term.

    def fibo(n):
        sequence = [0, 1]
        for i in range(2, n):
            next_number = sequence[-1] + sequence[-2]
            sequence.append(next_number)
        return sequence[:n]  # returns only the first 'n' numbers
    
    # Usage
    n = 10  # for example, to get the first 10 Fibonacci numbers
    fibonacci_numbers = fibo(n)
    print(fibonacci_numbers)
    

    When you run this script, it will print out the first 10 Fibonacci numbers. You can adjust the value of n to generate more or fewer terms from the series.