give me code for computing the fibonacci sequence
- User
give me code for computing the fibonacci sequence
Assistant
The fibonacci sequence is a sequence of numbers, where each number is the sum of the two numbers before that number. The first few numbers of the sequence are 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89,... Some common ways to compute the fibonacci sequence are the following:
def fib(n): if n < 2: return 0 elif n < 3: return 1 else: return fib(n-1) + fib(n-2)
print(fib(10))
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.