Skip to content

Instantly share code, notes, and snippets.

@kevin-weitgenant
Created August 4, 2016 23:54
Show Gist options
  • Save kevin-weitgenant/a8a15088b54837e8c1f1b7db1c5ff1c2 to your computer and use it in GitHub Desktop.
Save kevin-weitgenant/a8a15088b54837e8c1f1b7db1c5ff1c2 to your computer and use it in GitHub Desktop.
practicepython.org Exercise 13
def x(number):
fibonacci = [1, 1]
for _ in range(number-2):
last = len(fibonacci) - 1
penultimo = len(fibonacci) - 2
resultado = int(fibonacci[last]) + int(fibonacci[penultimo])
fibonacci.append(resultado)
return fibonacci
y = int(input("How many fibonacci numbers do you want?"))
print(x(y))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment