Created
June 4, 2021 21:33
-
-
Save natan20200679/92f65d0d4e1509ab50b301f2edc076aa to your computer and use it in GitHub Desktop.
Lista de Exercícios Python Brasil
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| """ 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