├── .github └── ISSUE_TEMPLATE │ └── sugestão-de-assunto---one-minute.md ├── .gitignore ├── README.md ├── code ├── one-minute-001.py ├── one-minute-002.py ├── one-minute-003.py ├── one-minute-004.py ├── one-minute-005.py ├── one-minute-006.py ├── one-minute-007.py ├── one-minute-008.py ├── one-minute-009.py ├── one-minute-010.py ├── one-minute-011.py ├── one-minute-012.py ├── one-minute-013.py ├── one-minute-014.py ├── one-minute-015.py ├── one-minute-016.py ├── one-minute-017.py ├── one-minute-018.py ├── one-minute-019.py ├── one-minute-020.py ├── one-minute-021.py ├── one-minute-022.py ├── one-minute-023.py ├── one-minute-024.py ├── one-minute-025.py ├── one-minute-026.py ├── one-minute-027.py ├── one-minute-028.py ├── one-minute-029.py ├── one-minute-030.py ├── one-minute-031.py ├── one-minute-032.py ├── one-minute-033.py ├── one-minute-034.py ├── one-minute-035.py └── one-minute-036.py ├── img ├── github.png ├── instagram.png └── youtube.png └── lista.md /.github/ISSUE_TEMPLATE/sugestão-de-assunto---one-minute.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Sugestão de assunto - one minute 3 | about: Template para sugestões de novos assuntos 4 | title: Sugestão de assunto 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | 11 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Byte-compiled / optimized / DLL files 2 | __pycache__/ 3 | *.py[cod] 4 | *$py.class 5 | 6 | # C extensions 7 | *.so 8 | 9 | # Distribution / packaging 10 | .Python 11 | build/ 12 | develop-eggs/ 13 | dist/ 14 | downloads/ 15 | eggs/ 16 | .eggs/ 17 | lib/ 18 | lib64/ 19 | parts/ 20 | sdist/ 21 | var/ 22 | wheels/ 23 | share/python-wheels/ 24 | *.egg-info/ 25 | .installed.cfg 26 | *.egg 27 | MANIFEST 28 | 29 | # PyInstaller 30 | # Usually these files are written by a python script from a template 31 | # before PyInstaller builds the exe, so as to inject date/other infos into it. 32 | *.manifest 33 | *.spec 34 | 35 | # Installer logs 36 | pip-log.txt 37 | pip-delete-this-directory.txt 38 | 39 | # Unit test / coverage reports 40 | htmlcov/ 41 | .tox/ 42 | .nox/ 43 | .coverage 44 | .coverage.* 45 | .cache 46 | nosetests.xml 47 | coverage.xml 48 | *.cover 49 | *.py,cover 50 | .hypothesis/ 51 | .pytest_cache/ 52 | cover/ 53 | 54 | # Translations 55 | *.mo 56 | *.pot 57 | 58 | # Django stuff: 59 | *.log 60 | local_settings.py 61 | db.sqlite3 62 | db.sqlite3-journal 63 | 64 | # Flask stuff: 65 | instance/ 66 | .webassets-cache 67 | 68 | # Scrapy stuff: 69 | .scrapy 70 | 71 | # Sphinx documentation 72 | docs/_build/ 73 | 74 | # PyBuilder 75 | .pybuilder/ 76 | target/ 77 | 78 | # Jupyter Notebook 79 | .ipynb_checkpoints 80 | 81 | # IPython 82 | profile_default/ 83 | ipython_config.py 84 | 85 | # pyenv 86 | # For a library or package, you might want to ignore these files since the code is 87 | # intended to run in multiple environments; otherwise, check them in: 88 | # .python-version 89 | 90 | # pipenv 91 | # According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control. 92 | # However, in case of collaboration, if having platform-specific dependencies or dependencies 93 | # having no cross-platform support, pipenv may install dependencies that don't work, or not 94 | # install all needed dependencies. 95 | #Pipfile.lock 96 | 97 | # poetry 98 | # Similar to Pipfile.lock, it is generally recommended to include poetry.lock in version control. 99 | # This is especially recommended for binary packages to ensure reproducibility, and is more 100 | # commonly ignored for libraries. 101 | # https://python-poetry.org/docs/basic-usage/#commit-your-poetrylock-file-to-version-control 102 | #poetry.lock 103 | 104 | # pdm 105 | # Similar to Pipfile.lock, it is generally recommended to include pdm.lock in version control. 106 | #pdm.lock 107 | # pdm stores project-wide configurations in .pdm.toml, but it is recommended to not include it 108 | # in version control. 109 | # https://pdm.fming.dev/#use-with-ide 110 | .pdm.toml 111 | 112 | # PEP 582; used by e.g. github.com/David-OConnor/pyflow and github.com/pdm-project/pdm 113 | __pypackages__/ 114 | 115 | # Celery stuff 116 | celerybeat-schedule 117 | celerybeat.pid 118 | 119 | # SageMath parsed files 120 | *.sage.py 121 | 122 | # Environments 123 | .env 124 | .venv 125 | env/ 126 | venv/ 127 | ENV/ 128 | env.bak/ 129 | venv.bak/ 130 | 131 | # Spyder project settings 132 | .spyderproject 133 | .spyproject 134 | 135 | # Rope project settings 136 | .ropeproject 137 | 138 | # mkdocs documentation 139 | /site 140 | 141 | # mypy 142 | .mypy_cache/ 143 | .dmypy.json 144 | dmypy.json 145 | 146 | # Pyre type checker 147 | .pyre/ 148 | 149 | # pytype static type analyzer 150 | .pytype/ 151 | 152 | # Cython debug symbols 153 | cython_debug/ 154 | 155 | # PyCharm 156 | # JetBrains specific template is maintained in a separate JetBrains.gitignore that can 157 | # be found at https://github.com/github/gitignore/blob/main/Global/JetBrains.gitignore 158 | # and can be added to the global gitignore or merged into this file. For a more nuclear 159 | # option (not recommended) you can uncomment the following to ignore the entire idea folder. 160 | #.idea/ 161 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # one-minute 2 | _One Minute_ é um projeto de divulgação de conteúdo de forma rápida e objetiva sobre Python nas redes sociais, em forma de vídeos curtos de até 1 minuto. 3 | 4 | ## Repositório 5 | Nesse repositório você encontra os códigos e videos [listados nessa página](lista.md). 6 | 7 | ## Redes sociais 8 | Os vídeos são publicados nas seguintes redes sociais: 9 | - [Instagram](https://www.instagram.com/codeshowbr/) 10 | - [Youtube](https://www.youtube.com/@codeshowbr/shorts) 11 | 12 | ## Quer indicar um assunto? 13 | Abra uma [issue](https://github.com/codeshow/one-minute/issues) com o título `Sugestão de assunto` e no corpo da mensagem coloque o assunto que você gostaria de ver em um vídeo. 14 | -------------------------------------------------------------------------------- /code/one-minute-001.py: -------------------------------------------------------------------------------- 1 | texto = 'CodeShow' 2 | inteiro = 105 3 | fracionario = 1.3 4 | logico = True 5 | 6 | tipo_str = type(texto) 7 | tipo_int = type(inteiro) 8 | tipo_float = type(fracionario) 9 | tipo_bool = type(logico) 10 | 11 | print("**Tipos de dados básicos em Python**\n") 12 | print(f"Texto: \t\t{texto}\t {tipo_str}") 13 | print(f"Inteiro: \t{inteiro}\t\t {tipo_int}") 14 | print(f"Fracionário: \t{fracionario}\t\t {tipo_float}") 15 | print(f"Lógico: \t{logico}\t\t {tipo_bool}") 16 | -------------------------------------------------------------------------------- /code/one-minute-002.py: -------------------------------------------------------------------------------- 1 | soma = 1 + 1 2 | subtracao = 2 - 1 3 | multiplicacao = 3 * 2 4 | divisao = 4 / 2 5 | 6 | divisao_inteira = 17 // 3 7 | resto_divisao = 17 % 3 8 | potenciacao = 5 ** 2 9 | precedencia_operacao = 5 + 2 * 2 10 | 11 | 12 | print(f'''** Operações ** 13 | {"Soma:":<24} 1 + 1 = {soma} 14 | {"Subtração:":24} 2 - 1 = {subtracao} 15 | {"Multiplicação:":24} 3 * 2 = {multiplicacao} 16 | {"Divisao:":24} 4 / 2 = {divisao} 17 | {"Divisao Inteira:":24} 17 // 3 = {divisao_inteira} 18 | {"Resto da Divisao:":24} 17 % 3 = {resto_divisao} 19 | {"Precedência de operação:":24} 5 + 2 * 2 = {precedencia_operacao}''') -------------------------------------------------------------------------------- /code/one-minute-003.py: -------------------------------------------------------------------------------- 1 | texto_simples = 'Simples é melhor do que complexo.' 2 | texto_duplas = "Complexo é melhor do que complicado." 3 | 4 | paragrafo = 'Primeira linha.\nSegunda linha.' 5 | espacamento = 'Primeiro texto.\tSegundo texto.' 6 | 7 | caminho = 'C:\nome\pasta' 8 | escape_caminho = r'C:\nome\pasta' 9 | 10 | 11 | print(f''' 12 | *** Aspas *** 13 | Simples: {texto_simples} 14 | Duplas: {texto_duplas} 15 | 16 | *** Caracteres de especiais *** 17 | Parágrafo: {paragrafo} 18 | Espaçamento: {espacamento} 19 | 20 | ** Ignorando caracteres especiais ** 21 | Caminho: {caminho} 22 | Caminho: {escape_caminho} 23 | ''') -------------------------------------------------------------------------------- /code/one-minute-004.py: -------------------------------------------------------------------------------- 1 | soma = 2 + 2 2 | multiplicacao = 2 * 3 3 | 4 | concatenacao_texto = 'Legibilidade ' + 'conta.' 5 | repeticao = 'Agora é melhor do que nunca.\n' * 3 6 | precedencia = 2 * 'Agora ' + 'é melhor do que nunca.' 7 | 8 | print(f''' 9 | *** Soma e multiplicação *** 10 | 2 + 2 = {soma} 11 | 2 * 3 = {multiplicacao} 12 | 13 | *** Concatenação e repetição*** 14 | Concatenação = {concatenacao_texto} 15 | Repetição = {repeticao} 16 | Precedência = {precedencia} 17 | ''') -------------------------------------------------------------------------------- /code/one-minute-005.py: -------------------------------------------------------------------------------- 1 | concatena_operador = 'Um texto ' + 'mais outro' 2 | concatena_textos = 'Code' 'Show' 3 | concatena_linhas = ('Casos especiais não são ' 4 | 'especiais o suficiente ' 5 | 'para quebrar as regras.') 6 | 7 | texto_formatado = '''\ 8 | - Plano é melhor do que denso primeira 9 | - Legibilidade conta segunda 10 | - Erros nunca devem passar silenciosamente terceira 11 | ''' 12 | 13 | print(f'''\ 14 | *** Concatenação com operador *** 15 | {concatena_operador} 16 | 17 | *** Concatenação textos*** 18 | {concatena_textos} 19 | 20 | *** Concatenação linhas*** 21 | {concatena_linhas} 22 | 23 | *** Texto formatado *** 24 | {texto_formatado} 25 | ''') -------------------------------------------------------------------------------- /code/one-minute-006.py: -------------------------------------------------------------------------------- 1 | texto = 'CodeShow' 2 | tamanho = len(texto) 3 | primeira_letra = texto[0] 4 | ultima_letra = texto[-1] 5 | primeira_palavra = texto[0:4] 6 | ultima_palavra = texto[4:8] 7 | meio_texto = texto[2:6] 8 | 9 | 10 | print(f'''\ 11 | *** Acessando subtextos *** 12 | {'Texto = ':20}{texto} 13 | {'Tamanho = ':20}{tamanho} 14 | {'Primeira letra = ':20}{primeira_letra} 15 | {'Última letra = ':20}{ultima_letra} 16 | {'Primeira palavra = ':20}{primeira_palavra} 17 | {'Última palavra = ':20}{ultima_palavra} 18 | {'Meio do texto = ':20}{meio_texto} 19 | ''') 20 | -------------------------------------------------------------------------------- /code/one-minute-007.py: -------------------------------------------------------------------------------- 1 | texto = 'Python Brasil' 2 | tamanho = len(texto) 3 | # texto[start:stop:step] 4 | pares = texto[::2] 5 | invertido = texto[::-1] 6 | 7 | 8 | print(f'''\ 9 | *** Accessando subtextos *** 10 | {'Texto = ':13}{texto} 11 | {'Tamanho = ':13}{tamanho} 12 | {'Pares = ':13}{pares} 13 | {'Invertido = ':13}{invertido} 14 | ''') 15 | -------------------------------------------------------------------------------- /code/one-minute-008.py: -------------------------------------------------------------------------------- 1 | lista = ['tipo', 'lista'] 2 | lista_inteiro = [1, 2, 3, 4] 3 | lista_float = [1.1, 2.2, 3.3, 4.4] 4 | lista_string = [ 5 | 'um', 'dois', 'três', 'quatro' 6 | ] 7 | lista_mista = [1, 2.2, 'três', 4.4,] 8 | 9 | print(f'''\ 10 | *** Listas *** 11 | {'Tipo Lista = ':20}{type(lista)} 12 | {'Lista de inteiros = ':20}{lista_inteiro} 13 | {'Lista de floats = ':20}{lista_float} 14 | {'Lista de strings = ':20}{lista_string} 15 | {'Lista mista = ':20}{lista_mista} 16 | ''') 17 | -------------------------------------------------------------------------------- /code/one-minute-009.py: -------------------------------------------------------------------------------- 1 | lista_compras = [ 2 | 'pão', 3 | 'frutas', 4 | 'legumes', 5 | 'verduras', 6 | ] 7 | 8 | primeiro_item = lista_compras[0] 9 | ultimo_item = lista_compras[-1] 10 | parte_lista = lista_compras[1:3] 11 | pares_lista = lista_compras[::2] 12 | # [start:stop:step] 13 | 14 | 15 | print(f'''\ 16 | *** Acesso em listas *** 17 | {'Lista de compras = ':25}{lista_compras} 18 | {'Primeiro item = ':25}{primeiro_item} 19 | {'Último item = ':25}{ultimo_item} 20 | {'Parte da lista = ':25}{parte_lista} 21 | {'Pares da lista = ':25}{pares_lista} 22 | {'Tipo item individual = ':25}{type(ultimo_item)} 23 | {'Tipo varios itens = ':25}{type(pares_lista)} 24 | ''') 25 | 26 | -------------------------------------------------------------------------------- /code/one-minute-010.py: -------------------------------------------------------------------------------- 1 | lista_compras = [ 2 | 'pão', 3 | 'frutas', 4 | 'legumes', 5 | 'verduras', 6 | ] 7 | 8 | lista_compras = lista_compras + ['molhos'] 9 | lista_compras += ['massas'] 10 | 11 | posicao = lista_compras[0] 12 | lista_compras[0] = 'pão integral' 13 | posicao_atualizada = lista_compras[0] 14 | 15 | 16 | print(f'''\ 17 | *** Atualização em listas *** 18 | {'Lista de compras = ':25}{lista_compras} 19 | {'Posição[0] = ':25}{posicao} 20 | {'Posição[0] atualizada = ':25}{posicao_atualizada} 21 | ''') 22 | -------------------------------------------------------------------------------- /code/one-minute-011.py: -------------------------------------------------------------------------------- 1 | lista_compras = [ 2 | 'pão', 3 | 'frutas', 4 | ] 5 | lista_original = lista_compras.copy() 6 | 7 | lista_compras.append('vinho') 8 | lista_append = lista_compras.copy() 9 | 10 | lista_compras.insert(2, 'molhos') 11 | lista_insert = lista_compras.copy() 12 | 13 | lista_compras.extend( 14 | ['bolo', 'arroz'] 15 | ) 16 | lista_compras.extend( 17 | ('doces', 'salgados') 18 | ) 19 | lista_compras.extend( 20 | {'massas', 'biscoitos'} 21 | ) 22 | lista_extend = lista_compras.copy() 23 | 24 | print(f'''\ 25 | *** Atualização em listas *** 26 | {'Lista original = ':17}{lista_original} 27 | {'Lista append = ':17}{lista_append} 28 | {'Lista insert = ':17}{lista_insert} 29 | {'Lista extend = ':17}{lista_extend} 30 | ''') 31 | -------------------------------------------------------------------------------- /code/one-minute-012.py: -------------------------------------------------------------------------------- 1 | lista_compras = [ 2 | 'pão', 3 | 'frutas', 4 | 'arroz', 5 | 'feijão', 6 | 'café', 7 | 'legumes', 8 | 'verduras', 9 | ] 10 | lista_original = lista_compras.copy() 11 | 12 | lista_compras.remove('pão') 13 | lista_remove = lista_compras.copy() 14 | 15 | remove_ultimo = lista_compras.pop() 16 | remove_index = lista_compras.pop(2) 17 | remove_index_negativo = lista_compras.pop(-2) 18 | lista_pop = lista_compras.copy() 19 | 20 | lista_compras.clear() 21 | lista_clear = lista_compras.copy() 22 | 23 | print(f'''\ 24 | *** Remoção de elementos em listas *** 25 | {'Lista de compras = ':25} 26 | {'':3}{lista_original} 27 | {'Remoção por remove= ':25} 28 | {'':3}{lista_remove} 29 | {'Retorno do último = ':23}{remove_ultimo} 30 | {'Retorno do índice 2 = ':23}{remove_index} 31 | {'Retorno do índice -2 = ':23}{remove_index_negativo} 32 | {'Remoção por pop = ':25} 33 | {'':3}{lista_pop} 34 | {'Remoção de todos itens = ':25}{lista_clear} 35 | ''') 36 | -------------------------------------------------------------------------------- /code/one-minute-013.py: -------------------------------------------------------------------------------- 1 | entrada = 10 2 | 3 | certo = entrada == 10 4 | errado = entrada != 10 5 | maior = entrada > 10 6 | maior_igual = entrada >= 10 7 | menor = entrada < 10 8 | menor_igual = entrada <= 10 9 | 10 | 11 | 12 | print(f'''\ 13 | *** Operadores de comparação *** 14 | {'Entrada = ':22}{entrada} 15 | {'Igual a 10 = ':22}{certo} 16 | {'Diferente de 10 = ':22}{errado} 17 | {'Maior que 10 = ':22}{maior} 18 | {'Maior ou igual a 10 = ':22}{maior_igual} 19 | {'Menor que 10 = ':22}{menor} 20 | {'Menor ou igual a 10 = ':22}{menor_igual} 21 | ''') 22 | -------------------------------------------------------------------------------- /code/one-minute-014.py: -------------------------------------------------------------------------------- 1 | texto = 'Texto inicial' 2 | 3 | if True: 4 | texto = 'Dentro do bloco if' 5 | elif False: 6 | texto = 'Dentro do bloco elif' 7 | else: 8 | texto = 'Dentro do bloco else' 9 | if True: 10 | texto = 'Dentro do bloco if do else' 11 | 12 | texto = 'Fora do bloco if' 13 | normal = 'Volta ao fluxo normal' 14 | -------------------------------------------------------------------------------- /code/one-minute-015.py: -------------------------------------------------------------------------------- 1 | if True: 2 | print('Verdadeiro') 3 | 4 | variavel = 'Existe' 5 | if variavel: 6 | print('Variavel existe') 7 | 8 | variavel_none = None 9 | if variavel_none: 10 | print('Variavel None existe') 11 | print('Variavel None não existe') 12 | 13 | nome = 'Code' 14 | if nome == 'Code': 15 | print('Nome correto') 16 | 17 | numero = 10 18 | if numero >= 10: 19 | print('Numero maior ou igual a 10') 20 | 21 | lista = [1, 2, 3] 22 | if 2 in lista: 23 | print('Existe o número 2 na lista') 24 | -------------------------------------------------------------------------------- /code/one-minute-016.py: -------------------------------------------------------------------------------- 1 | numero = 5 2 | if numero > 15: 3 | print('Numero é maior que 15') 4 | elif numero > 10: 5 | print('Numero é maior que 10') 6 | else: 7 | print('Numero é menor que 10') 8 | print('Segue o fluxo normal') 9 | -------------------------------------------------------------------------------- /code/one-minute-017.py: -------------------------------------------------------------------------------- 1 | print("Hello") 2 | print("Hello") 3 | print("Hello") 4 | print("Hello") 5 | 6 | for i in range(4): 7 | print(f"Hello for {i}") 8 | 9 | 10 | for j in range(2,6): 11 | print(f"Número: {j}") 12 | -------------------------------------------------------------------------------- /code/one-minute-018.py: -------------------------------------------------------------------------------- 1 | # for item in sequence: 2 | 3 | print('*** Strings ***') 4 | palavra = 'Python' 5 | for letra in palavra: 6 | print(letra) 7 | 8 | print('*** Listas ***') 9 | lista = ['Python', 'Java', 'C#'] 10 | for linguagem in lista: 11 | print(linguagem) 12 | 13 | print('*** Dicionarios ***') 14 | dicionario = {'linguagem': 'Python', 'versão': 3.12, 'biblioteca': 'pandas'} 15 | for chave in dicionario: 16 | print(f'{chave}: {dicionario[chave]}') 17 | -------------------------------------------------------------------------------- /code/one-minute-019.py: -------------------------------------------------------------------------------- 1 | # while True: 2 | 3 | entrada_usuario = 3 4 | while entrada_usuario > 0: 5 | print(f'Entrada do usuário: {entrada_usuario}') 6 | entrada_usuario -= 1 7 | 8 | print(f'Fim dessa repetição! Entrada do usuário: {entrada_usuario}') 9 | -------------------------------------------------------------------------------- /code/one-minute-020.py: -------------------------------------------------------------------------------- 1 | def soma(primeiros, segundos): 2 | resultado = primeiros + segundos 3 | return resultado 4 | 5 | print("*** Soma de dois números ***") 6 | print(soma(2, 3)) 7 | print(soma(5, 7)) 8 | print(soma(10, 20)) 9 | print(soma(100, 200)) 10 | -------------------------------------------------------------------------------- /code/one-minute-021.py: -------------------------------------------------------------------------------- 1 | def funcao(): 2 | local = "Função" 3 | return local 4 | 5 | print(f'Retorno da função: {funcao()}\n') 6 | 7 | def procedimento(): 8 | local = "Procedimento" 9 | print(local) 10 | 11 | print(f'Execução do procedimento: {procedimento()}') 12 | -------------------------------------------------------------------------------- /code/one-minute-022.py: -------------------------------------------------------------------------------- 1 | # Escopo 2 | escopo = "Global" 3 | acessivel = "Apenas uso" 4 | 5 | def funcao(): 6 | escopo = "Local" 7 | 8 | print(f'"escopo" dentro da função: {escopo}\nid: {id(escopo)}\n') 9 | 10 | print(f'"acessivel" dentro da função: {acessivel}\nid: {id(acessivel)}\n') 11 | 12 | funcao() 13 | 14 | print(f'"escopo" fora da função: {escopo}\nid: {id(escopo)}\n') 15 | print(f'"acessivel" fora da função: {acessivel}\nid: {id(acessivel)}\n') 16 | -------------------------------------------------------------------------------- /code/one-minute-023.py: -------------------------------------------------------------------------------- 1 | lista = [1, 2, 3, 4, 5] 2 | 3 | print("if a or b in lista:") 4 | def verifica_se_esta_na_lista(a, b): 5 | if a or b in lista: 6 | print("Sim") 7 | else: 8 | print("Não") 9 | 10 | print("Retorna 'Sim' nos casos de False ou True | True ou False | True ou True") 11 | verifica_se_esta_na_lista(2, 4) 12 | verifica_se_esta_na_lista(2, 40) 13 | verifica_se_esta_na_lista(20, 40) 14 | 15 | print("Retorna 'Não' nos casos de False ou False") 16 | verifica_se_esta_na_lista(0, 0) 17 | verifica_se_esta_na_lista('', '') 18 | verifica_se_esta_na_lista(None, None) 19 | -------------------------------------------------------------------------------- /code/one-minute-024.py: -------------------------------------------------------------------------------- 1 | lista = [1, 2, 3, 4, 5] 2 | 3 | print("if {a, b}.intersection(lista)") 4 | def verifica_se_esta_na_lista(a, b): 5 | if {a, b}.intersection(lista): 6 | print("Sim") 7 | else: 8 | print("Não") 9 | 10 | print("Retorna 'Sim' nos casos de False ou True | True ou False | True ou True") 11 | verifica_se_esta_na_lista(2, 4) 12 | verifica_se_esta_na_lista(2, 40) 13 | verifica_se_esta_na_lista(15, 1) 14 | 15 | print("Retorna 'Não' nos casos de False ou False") 16 | verifica_se_esta_na_lista(20, 40) 17 | verifica_se_esta_na_lista(0, 0) 18 | verifica_se_esta_na_lista('', None) 19 | -------------------------------------------------------------------------------- /code/one-minute-025.py: -------------------------------------------------------------------------------- 1 | # Estrutura de dados: Pilhas LIFO 2 | 3 | pilha = ['a', 'b', 'c'] 4 | pilha.append('d') 5 | pilha.append('e') 6 | 7 | print(f""" *** Pilhas *** 8 | pilha: {pilha} 9 | pilha.pop(): {pilha.pop()} 10 | pilha.pop(): {pilha.pop()} 11 | pilha.pop(): {pilha.pop()} 12 | pilha.pop(): {pilha.pop()} 13 | pilha: {pilha} 14 | """) -------------------------------------------------------------------------------- /code/one-minute-026.py: -------------------------------------------------------------------------------- 1 | # Estrutura de dados: Filas FIFO 2 | from collections import deque 3 | 4 | fila = deque(['a', 'b', 'c'], maxlen=5) 5 | fila.append('d') 6 | fila.append('e') 7 | 8 | print(f""" *** Filas *** 9 | fila: {fila} 10 | fila.pop(): {fila.popleft()} 11 | fila.pop(): {fila.popleft()} 12 | fila.pop(): {fila.popleft()} 13 | fila.pop(): {fila.popleft()} 14 | fila: {fila} 15 | """) 16 | -------------------------------------------------------------------------------- /code/one-minute-027.py: -------------------------------------------------------------------------------- 1 | list_manual_10 = [ 2 | 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 3 | ] 4 | list_manual_1000 = ... 5 | 6 | # List comprehensions 7 | list_comp = [numero for numero in range(16)] 8 | 9 | # Lista com for 10 | list_for = [] 11 | for numero in range(16): 12 | list_for.append(numero) 13 | 14 | 15 | print(f""" *** Listas *** 16 | Lista com 'list comp': 17 | {list_comp} 18 | Lista com 'for': 19 | {list_for} 20 | """) 21 | -------------------------------------------------------------------------------- /code/one-minute-028.py: -------------------------------------------------------------------------------- 1 | # List comprehensions 2 | # Sequência com range 3 | simples = [numero for numero in range(5)] 4 | 5 | # Pares com condicional if 6 | pares = [numero for numero in range(5) 7 | if numero % 2 == 0] 8 | 9 | # Dobro com operação matematica 10 | dobro = [numero*2 for numero in range(5)] 11 | 12 | 13 | print(f""" *** Listas *** 14 | Sequencia: {simples} 15 | Pares: {pares} 16 | Dobro: {dobro} 17 | """) 18 | -------------------------------------------------------------------------------- /code/one-minute-029.py: -------------------------------------------------------------------------------- 1 | # List comprehensions - aninhadas 2 | matriz = [ 3 | [j for j in range(3)] 4 | for i in range(3)] 5 | 6 | 7 | # for aninhado 8 | matriz_for = [] 9 | for i in range(3): 10 | linha = [] 11 | for j in range(3): 12 | linha.append(j) 13 | matriz_for.append(linha) 14 | 15 | 16 | print(f""" 17 | Matriz list comp: 18 | {matriz} 19 | Matriz for aninhado: 20 | {matriz_for} 21 | """) 22 | -------------------------------------------------------------------------------- /code/one-minute-030.py: -------------------------------------------------------------------------------- 1 | # Instrução del 2 | compras = [ 3 | "banana", 4 | "maçã", 5 | "pera", 6 | "abacate" 7 | ] 8 | del compras[2] 9 | 10 | cores = [ 11 | "azul", 12 | "amarelo", 13 | "preto", 14 | "vermelho", 15 | "verde", 16 | "cinza" 17 | ] 18 | del cores[1::2] 19 | 20 | 21 | print(f""" **** Instrução del **** 22 | Lista compras: 23 | {compras} 24 | Lista cores: 25 | {cores} 26 | """) 27 | -------------------------------------------------------------------------------- /code/one-minute-031.py: -------------------------------------------------------------------------------- 1 | # Função dir() 2 | nomes_lista = dir(list) 3 | nomes_str = dir(str) 4 | nomes_local = dir() 5 | 6 | 7 | print(f""" **** Função dir() **** 8 | Lista: 9 | {nomes_lista} 10 | 11 | String: 12 | {nomes_str} 13 | 14 | Local: 15 | {nomes_local} 16 | """) 17 | -------------------------------------------------------------------------------- /code/one-minute-032.py: -------------------------------------------------------------------------------- 1 | # Expressão lambda 2 | 3 | # lambda arg_1, arg_2: expressão 4 | soma_lambda = lambda a, b: a + b 5 | 6 | def soma(a, b): 7 | return a + b 8 | 9 | 10 | print(f""" **** Expressão lambda **** 11 | lambda 1 + 2: 12 | {soma_lambda(1,2)} 13 | 14 | função 1 + 2: 15 | {soma(1,2)} 16 | """) 17 | -------------------------------------------------------------------------------- /code/one-minute-033.py: -------------------------------------------------------------------------------- 1 | # Expressão lambda 2 | maior = lambda a, b: a if a > b else b 3 | 4 | lista = [1,2,3,4,5] 5 | contem = lambda x: x in lista 6 | 7 | verifica_int = lambda n: type(n) is int 8 | 9 | 10 | print(f""" ****lambda e diferentes expressões **** 11 | maior(5,8): {maior(5,8)} 12 | maior(10,2): {maior(10,2)} 13 | contem(7): {contem(7)} 14 | contem(1): {contem(1)} 15 | verifica_int(1): {verifica_int(1)} 16 | verifica_int(5.7): {verifica_int(5.7)} 17 | """) 18 | -------------------------------------------------------------------------------- /code/one-minute-034.py: -------------------------------------------------------------------------------- 1 | def f(pos1, pos2, /, pos_kwd, *, kwd): 2 | print('Valores:') 3 | print(f'pos1: {pos1}, pos2: {pos2}, pos_kwd: {pos_kwd}, kwd: {kwd}') 4 | 5 | 6 | f(1, 2, 3, kwd=4) 7 | f(1, 2, pos_kwd=3, kwd=4) 8 | f(1, 2, 3, 4) 9 | -------------------------------------------------------------------------------- /code/one-minute-035.py: -------------------------------------------------------------------------------- 1 | # *args e *kwargs 2 | 3 | def listar_animais(*args): 4 | print(f'Listar:\n{args}\n') 5 | 6 | listar_animais("Cachorro", "Gato", "Elefante", "Tigre") 7 | 8 | 9 | def info_animal(**kwargs): 10 | print(f"Informar:\n{kwargs}") 11 | 12 | info_animal(nome="Cachorro", cor="Marrom", habitat="Doméstico", idade=5) -------------------------------------------------------------------------------- /code/one-minute-036.py: -------------------------------------------------------------------------------- 1 | import math 2 | 3 | # valores 4 | valor_pi = math.pi 5 | valor_e = math.e 6 | valor_tau = math.tau 7 | 8 | # calculos 9 | potencia = math.pow(9,2) 10 | log = math.log2(9) 11 | raiz = math.sqrt(9) 12 | 13 | 14 | print(f""" **** Modulo Math **** 15 | π (pi): 16 | {valor_pi} 17 | e (euler): 18 | {valor_e} 19 | τ (tau): 20 | {valor_tau} 21 | 22 | x elevado a y: 23 | {potencia} 24 | Log2 de x: 25 | {log} 26 | Raiz quadrada de x: 27 | {raiz} 28 | """) 29 | -------------------------------------------------------------------------------- /img/github.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeshow/one-minute/e26a7a57a6c15370cd5611647f0540cf425d530b/img/github.png -------------------------------------------------------------------------------- /img/instagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeshow/one-minute/e26a7a57a6c15370cd5611647f0540cf425d530b/img/instagram.png -------------------------------------------------------------------------------- /img/youtube.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/codeshow/one-minute/e26a7a57a6c15370cd5611647f0540cf425d530b/img/youtube.png -------------------------------------------------------------------------------- /lista.md: -------------------------------------------------------------------------------- 1 | # Lista de assuntos 2 | 3 | 4 | |ID|Assunto|Shorts|Reels|Code| 5 | |---|---|:---:|:---:|:---:| 6 | |001|Tipos de dados básicos | [![youtube](img/youtube.png)](https://www.youtube.com/shorts/z2xZJZ6PA2M) | [![instagram](img/instagram.png)](https://www.instagram.com/reel/C0Eu0g9gAxs/) | [![github](img/github.png)](https://github.com/codeshow/one-minute/blob/main/code/one-minute-001.py)| 7 | |002|Operações com números | [![youtube](img/youtube.png)](https://www.youtube.com/shorts/jUQaxG6bhZo) | [![instagram](img/instagram.png)](https://www.instagram.com/p/C0Wut8tAVq3/) | [![github](img/github.png)](https://github.com/codeshow/one-minute/blob/main/code/one-minute-002.py) | 8 | |003|Strings e caracteres especiais | [![youtube](img/youtube.png)](https://www.youtube.com/shorts/Jwx-ugiUNIc) | [![instagram](img/instagram.png)](https://www.instagram.com/p/C0oxOKVAPBk/) | [![github](img/github.png)](https://github.com/codeshow/one-minute/blob/main/code/one-minute-003.py) | 9 | |004|Strings e operações | [![youtube](img/youtube.png)](https://www.youtube.com/shorts/N6wnJDbKwmU) | [![instagram](img/instagram.png)](https://www.instagram.com/p/C06vpWoAiOX) | [![github](img/github.png)](https://github.com/codeshow/one-minute/blob/main/code/one-minute-004.py) | 10 | |005| Concatenação de strings | [![youtube](img/youtube.png)](https://www.youtube.com/shorts/TIUiT1nNuK8) | [![instagram](img/instagram.png)](https://www.instagram.com/reel/C1MuIMgAudu/) | [![github](img/github.png)](https://github.com/codeshow/one-minute/blob/main/code/one-minute-005.py) | 11 | |006| Índices de strings | [![youtube](img/youtube.png)](https://www.youtube.com/shorts/XVJWaLWejC8) | [![instagram](img/instagram.png)](https://www.instagram.com/reel/C1e2vFYAESE/) | [![github](img/github.png)](https://github.com/codeshow/one-minute/blob/main/code/one-minute-006.py) | 12 | |007| Substrings com step | [![youtube](img/youtube.png)](https://www.youtube.com/shorts/3hWRLv7OOvo) | [![instagram](img/instagram.png)](https://www.instagram.com/reel/C1wz2YigDla/) | [![github](img/github.png)](https://github.com/codeshow/one-minute/blob/main/code/one-minute-007.py) | 13 | |008| Definindo listas | [![youtube](img/youtube.png)](https://www.youtube.com/shorts/C--rxKPDoEM) | [![instagram](img/instagram.png)](https://www.instagram.com/p/C2C1y6EAyi0/) | [![github](img/github.png)](https://github.com/codeshow/one-minute/blob/main/code/one-minute-008.py) | 14 | |009| Acessando listas | [![youtube](img/youtube.png)](https://www.youtube.com/shorts/XrEK0jSGrSE) | [![instagram](img/instagram.png)](https://www.instagram.com/reel/C2UsrWkA-dO/) | [![github](img/github.png)](https://github.com/codeshow/one-minute/blob/main/code/one-minute-009.py) | 15 | |010| Modificando itens de listas | [![youtube](img/youtube.png)](https://www.youtube.com/shorts/tK-25YqRX2U) | [![instagram](img/instagram.png)](https://www.instagram.com/reel/C2msUjagwUb/) | [![github](img/github.png)](https://github.com/codeshow/one-minute/blob/main/code/one-minute-010.py) 16 | |011| Métodos de adição em listas | [![youtube](img/youtube.png)](https://www.youtube.com/shorts/ca1v39A9pCE) | [![instagram](img/instagram.png)](https://www.instagram.com/reel/C24tzJGg-4o/) | [![github](img/github.png)](https://github.com/codeshow/one-minute/blob/main/code/one-minute-011.py) 17 | |012| Métodos de remoção em listas | [![youtube](img/youtube.png)](https://www.youtube.com/shorts/bfSfxpKKbWs) | [![instagram](img/instagram.png)](https://www.instagram.com/reel/C3KvWaUgcz5/) | [![github](img/github.png)](https://github.com/codeshow/one-minute/blob/main/code/one-minute-012.py) 18 | |013| Operadores Relacionais | [![youtube](img/youtube.png)](https://www.youtube.com/shorts/d5AgA-mlHCY) | [![instagram](img/instagram.png)](https://www.instagram.com/reel/C3cyfz0A_gW/) | [![github](img/github.png)](https://github.com/codeshow/one-minute/blob/main/code/one-minute-013.py) 19 | |014| Indentação | [![youtube](img/youtube.png)](https://www.youtube.com/shorts/3HK3EhutFN4) | [![instagram](img/instagram.png)](https://www.instagram.com/reel/C3uvZcnAImf/) | [![github](img/github.png)](https://github.com/codeshow/one-minute/blob/main/code/one-minute-014.py) 20 | |015| Condicionais | [![youtube](img/youtube.png)](https://www.youtube.com/shorts/rPbqZIdu-ds) | [![instagram](img/instagram.png)](https://www.instagram.com/reel/C4A1W3tgfCG/) | [![github](img/github.png)](https://github.com/codeshow/one-minute/blob/main/code/one-minute-015.py) 21 | |016| Condicionais | [![youtube](img/youtube.png)](https://www.youtube.com/shorts/6HEa_yytf1g) | [![instagram](img/instagram.png)](https://www.instagram.com/reel/C4SzzhGg8hB/) | [![github](img/github.png)](https://github.com/codeshow/one-minute/blob/main/code/one-minute-016.py) 22 | |017| Repetição - for | [![youtube](img/youtube.png)](https://www.youtube.com/shorts/rqNdUMynHMg) | [![instagram](img/instagram.png)](https://www.instagram.com/reel/C4k6MdpAfhY/) | [![github](img/github.png)](https://github.com/codeshow/one-minute/blob/main/code/one-minute-017.py) 23 | |018| Repetição - for | [![youtube](img/youtube.png)](https://www.youtube.com/shorts/dpOqwp0V828) | [![instagram](img/instagram.png)](https://www.instagram.com/reel/C425BlNAmBJ/) | [![github](img/github.png)](https://github.com/codeshow/one-minute/blob/main/code/one-minute-018.py) 24 | |019| Repetição - while | [![youtube](img/youtube.png)](https://www.youtube.com/shorts/kdI27TJW68M) | [![instagram](img/instagram.png)](https://www.instagram.com/reel/C5I6XRjgMcO/) | [![github](img/github.png)](https://github.com/codeshow/one-minute/blob/main/code/one-minute-019.py) 25 | |020| Funções | [![youtube](img/youtube.png)](https://www.youtube.com/shorts/v0owr2G79qI) | [![instagram](img/instagram.png)](https://www.instagram.com/reel/C5a8UoLgJ0K/) | [![github](img/github.png)](https://github.com/codeshow/one-minute/blob/main/code/one-minute-020.py) 26 | |021| Funções e Procedimentos | [![youtube](img/youtube.png)](https://www.youtube.com/shorts/haaI8O-9VeI) | [![instagram](img/instagram.png)](https://www.instagram.com/reel/C5s9sMbALTy/) | [![github](img/github.png)](https://github.com/codeshow/one-minute/blob/main/code/one-minute-021.py) 27 | |022| Escopos | [![youtube](img/youtube.png)](https://www.youtube.com/shorts/m9azTWtikNI) | [![instagram](img/instagram.png)](https://www.instagram.com/reel/C6Q43xMAl9m/) | [![github](img/github.png)](https://github.com/codeshow/one-minute/blob/main/code/one-minute-022.py) 28 | |023| Busca com OR | [![youtube](img/youtube.png)](https://www.youtube.com/shorts/zSoR5TXGEjI) | [![instagram](img/instagram.png)](https://www.instagram.com/reel/C6jTrUQgdPE/) | [![github](img/github.png)](https://github.com/codeshow/one-minute/blob/main/code/one-minute-023.py) 29 | |024| Busca com intersection | [![youtube](img/youtube.png)](https://www.youtube.com/shorts/VS7cSFIeXwk) | [![instagram](img/instagram.png)](https://www.instagram.com/codeshowbr/reel/C9Fe7NKAcQL/) | [![github](img/github.png)](https://github.com/codeshow/one-minute/blob/main/code/one-minute-024.py) 30 | |025| Pilhas em Python | [![youtube](img/youtube.png)](https://www.youtube.com/shorts/cKLrLbI9MFg) | [![instagram](img/instagram.png)](https://www.instagram.com/codeshowbr/reel/C9XflfMAH_2/) | [![github](img/github.png)](https://github.com/codeshow/one-minute/blob/main/code/one-minute-025.py) 31 | |026| Filas em Python | [![youtube](img/youtube.png)](https://www.youtube.com/shorts/_3ZOMAgWpy0) | [![instagram](img/instagram.png)](https://www.instagram.com/codeshowbr/reel/C9paGZuAFTp/) | [![github](img/github.png)](https://github.com/codeshow/one-minute/blob/main/code/one-minute-026.py) 32 | |027| List Comprehensions | [![youtube](img/youtube.png)](https://www.youtube.com/shorts/1cqVUxEX5M4) | [![instagram](img/instagram.png)](https://www.instagram.com/codeshowbr/reel/C97desjgHNh/) | [![github](img/github.png)](https://github.com/codeshow/one-minute/blob/main/code/one-minute-027.py) 33 | |028| List Comprehensions | [![youtube](img/youtube.png)](https://www.youtube.com/shorts/JZQP6aVcqfA) | [![instagram](img/instagram.png)](https://www.instagram.com/codeshowbr/reel/C-NkPQignD2/) | [![github](img/github.png)](https://github.com/codeshow/one-minute/blob/main/code/one-minute-028.py) 34 | |029| List Comprehensions - aninhamento| [![youtube](img/youtube.png)](https://www.youtube.com/shorts/MrNZCFiDvtM) | [![instagram](img/instagram.png)](https://www.instagram.com/codeshowbr/reel/C-fhQSgAhqc/) | [![github](img/github.png)](https://github.com/codeshow/one-minute/blob/main/code/one-minute-029.py) 35 | |030| Instrução del | [![youtube](img/youtube.png)](https://www.youtube.com/shorts/Obqpm0SY4ps) | [![instagram](img/instagram.png)](https://www.instagram.com/codeshowbr/reel/C_DpKOTgIFo/) | [![github](img/github.png)](https://github.com/codeshow/one-minute/blob/main/code/one-minute-030.py) 36 | |031| Função dir | [![youtube](img/youtube.png)](https://www.youtube.com/shorts/fDEodQoDpPc) | [![instagram](img/instagram.png)](https://www.instagram.com/codeshowbr/reel/C_Vqr8ZArm_/) | [![github](img/github.png)](https://github.com/codeshow/one-minute/blob/main/code/one-minute-031.py) 37 | |032| Expressão lambda | [![youtube](img/youtube.png)](https://www.youtube.com/shorts/aF5qLK3ijiU) | [![instagram](img/instagram.png)](https://www.instagram.com/codeshowbr/reel/C_nsQ87gA7U/) | [![github](img/github.png)](https://github.com/codeshow/one-minute/blob/main/code/one-minute-032.py) 38 | |033| Expressão lambda | [![youtube](img/youtube.png)](https://www.youtube.com/shorts/CYNTuwUC48Q) | [![instagram](img/instagram.png)](https://www.instagram.com/codeshowbr/reel/C_5t3_lgDoG/) | [![github](img/github.png)](https://github.com/codeshow/one-minute/blob/main/code/one-minute-033.py) 39 | |034| Tipos de argumentos em funções | [![youtube](img/youtube.png)](https://www.youtube.com/shorts/8RJ3qk1CriY) | [![instagram](img/instagram.png)](https://www.instagram.com/codeshowbr/reel/DALvWAnOZc2/) | [![github](img/github.png)](https://github.com/codeshow/one-minute/blob/main/code/one-minute-034.py) 40 | |035| Tipos de argumentos em funções | [![youtube](img/youtube.png)](https://www.youtube.com/shorts/o2DnaYcRyw8) | [![instagram](img/instagram.png)](https://www.instagram.com/codeshowbr/reel/DAdw-52A-dP/) | [![github](img/github.png)](https://github.com/codeshow/one-minute/blob/main/code/one-minute-035.py) 41 | |036| Modulo Math | [![youtube](img/youtube.png)](https://www.youtube.com/shorts/1xdXYXqgxXs) | [![instagram](img/instagram.png)](https://www.instagram.com/codeshowbr/reel/DAvyiH4xAYT/) | [![github](img/github.png)](https://github.com/codeshow/one-minute/blob/main/code/one-minute-036.py) 42 | --------------------------------------------------------------------------------