Skip to content

Instantly share code, notes, and snippets.

@amtsh
Created April 23, 2022 22:01
Show Gist options
  • Save amtsh/56a87f1f4d126978332f2bb93d6db519 to your computer and use it in GitHub Desktop.
Save amtsh/56a87f1f4d126978332f2bb93d6db519 to your computer and use it in GitHub Desktop.
# ------------------------
# Generate Fibonacci sequence of length N
# ------------------------
def fibonacci_sequence(n):
sequence = [0, 1]
for i in range(2, n):
sequence.append(sequence[-1] + sequence[-2])
return sequence[:n]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment