Skip to content

Instantly share code, notes, and snippets.

@luizomf
Last active April 4, 2020 07:58
Show Gist options
  • Select an option

  • Save luizomf/54e04bc86a6d18907aa30175255e9b80 to your computer and use it in GitHub Desktop.

Select an option

Save luizomf/54e04bc86a6d18907aa30175255e9b80 to your computer and use it in GitHub Desktop.
# Para Type annotation
from typing import List
# Pilha de livros com type annotation
stack_of_books: List[str] = [] # {1}
# Adicionando livros no topo da pilha
stack_of_books.append('Livro 1') # {2}
stack_of_books.append('Livro 2') # {2}
stack_of_books.append('Livro 3') # {2}
# Laço for
for book in stack_of_books[::-1]:
# Faça o que preferir com o Livro
print(book)
"""
Saída:
Livro 3
Livro 2
Livro 1
"""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment