Skip to content

Instantly share code, notes, and snippets.

@natan20200679
Created June 4, 2021 21:33
Show Gist options
  • Select an option

  • Save natan20200679/92f65d0d4e1509ab50b301f2edc076aa to your computer and use it in GitHub Desktop.

Select an option

Save natan20200679/92f65d0d4e1509ab50b301f2edc076aa to your computer and use it in GitHub Desktop.
Lista de Exercícios Python Brasil
""" 15.A série de Fibonacci é formada pela seqüência 1,1,2,3,5,8,13,21,34,55,... Faça um programa capaz de gerar a série
até o n−ésimo termo. """
n = int(input("Posição do N-ésimo Termo:"))
penultimo = 1
ultimo = 1
cont = 1
print(penultimo, end = ',')
print(ultimo, end = ',')
while cont <= n:
termo = ultimo + penultimo
penultimo = ultimo
ultimo = termo
cont += 1
print(termo)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment