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
| """ | |
| Quicksort algorithm | |
| >>> print(quicksort(list_of_numbers)) | |
| [2, 2, 4, 5, 9, 10, 11, 122, 123, 321] | |
| >>> print(quicksort(list_of_words)) | |
| ['Aline', 'Helena', 'João', 'Luiz', 'Maria', 'Zara'] | |
| >>> print(quicksort(['A'])) | |
| ['A'] | |
| >>> print(quicksort(['B', 'A'])) |
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
| # 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} |
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
| # 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} |
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
| # 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} |
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
| # 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} |
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
| # 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} |
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
| # 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} |
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
| # 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} |
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
| # Para Type annotation | |
| from typing import List | |
| # Pilha de listas | |
| stack_of_lists: List[List[str]] = [] | |
| # Adicionando elementos | |
| stack_of_lists.append(['A', 'B']) | |
| stack_of_lists.append(['C', 'D']) | |
| stack_of_lists.append(['E', 'F']) |
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
| # Para Type annotation | |
| from typing import List | |
| # Pilha de listas | |
| stack_of_lists: List[List[str]] = [] | |
| # Adicionando elementos | |
| stack_of_lists.append(['A', 'B']) | |
| stack_of_lists.append(['C', 'D']) | |
| stack_of_lists.append(['E', 'F']) |