Skip to content
TheChatArchiveThe Chat Archive
Mistralmistral-medium· Mistral AIHugging Face Arena Human Preference 55K

write a python program to print the first 50 fibonacci numbers

From a Chatbot Arena battleThe same person sent this prompt to two anonymous models at once. Compare it with gpt-4-1106-preview’s answer.
  1. User

    write a python program to print the first 50 fibonacci numbers

  2. Mistral Assistant

    Here's a Python program to print the first 50 Fibonacci numbers:

    def fibonacci(n):
        fib_sequence = [0, 1]
        while len(fib_sequence) < n:
            fib_sequence.append(fib_sequence[-1] + fib_sequence[-2])
        return fib_sequence
    
    fib_numbers = fibonacci(50)
    
    for number in fib_numbers:
        print(number)
    

    This program defines a function fibonacci(n) that generates a Fibonacci sequence up to the nth term. It starts with a list containing the first two Fibonacci numbers, 0 and 1. Then, it enters a loop that continues until the length of the sequence reaches n. In each iteration of the loop, it appends the sum of the last two numbers in the sequence.

    Finally, the program calls the fibonacci() function with the argument 50, stores the result in the variable fib_numbers, and prints each number in the Fibonacci sequence using a for loop.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.