Grok 3, created by xAI, is a cutting-edge AI designed to assist with coding, business analysis, finance, and brain health.
def fibonacci(n):
if n <= 0:
return []
elif n == 1:
return [0]
fib = [0, 1]
for i in range(2, n):
fib.append(fib[i-1] + fib[i-2])
return fib
print(fibonacci(8)) # Output: [0, 1, 1, 2, 3, 5, 8, 13]
Explore how to use Grok 3 effectively on our How to Use page or see our Coding Projects.