Skip to content

Instantly share code, notes, and snippets.

@jasoncartwright
Created August 4, 2025 15:33
Show Gist options
  • Save jasoncartwright/d7ef600aa09b3065093cb3a53b192088 to your computer and use it in GitHub Desktop.
Save jasoncartwright/d7ef600aa09b3065093cb3a53b192088 to your computer and use it in GitHub Desktop.
def fibonacci_sequence(n):
if n <= 0:
return []
elif n == 1:
return [0]
elif n == 2:
return [0, 1]
fib_sequence = [0, 1]
for i in range(2, n):
next_value = fib_sequence[i - 1] + fib_sequence[i - 2]
fib_sequence.append(next_value)
return fib_sequence
print(fibonacci_sequence(100))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment