This file contains 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
name = "Guido Von" | |
print(name.lower()) | |
>>>guido von |
This file contains 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
tab = "\tIdentando texto" | |
>>> Identando Texto | |
nova_linha = "Explícito é melhor que implícito.\nSimples é melhor que complexo" | |
>>>Explícito é melhor que implícito. | |
Simples é melhor que complexo |
This file contains 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
texto = " Simples é melhor que complexo " | |
print(texto.rstrip()) #remove espaço em branco do lado direito | |
>>> Simples é melhor que complexo | |
print(texto.lstrip()) #remove espaço em branco do lado esquerdo | |
>>>Simples é melhor que complexo_ | |
print(texto.strip()) #remove espaço em branco dos dois lados | |
>>>Simples é melhor que complexo |
This file contains 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
ano = 1991 #Primeira variavel | |
nome = "Guido Van Rossun" #segunda variavel | |
print(f"Python foi criado em {ano}, por {nome}") #note o "f" antes de abrir aspas, e os nomes das variaveis dentro da chave | |
>>>Python foi criado em 1991 por Guido Van Rossun |
This file contains 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
aspas_duplas = "Erros nunca deveriam passar silenciosamente." | |
aspas_simples = 'A menos que explicitamente silenciados.' | |
aspas_duplas_simples = 'Ao encarar a ambiguidade, recuse a "tentação" de adivinhar.' |
This file contains 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
name = "guido von" | |
print(name.title()) | |
>>>Guido Von | |
name = "guido von" | |
print(name.upper()) | |
>>>GUIDO VON | |
name = "Guido Von" | |
print(name.lower()) |
This file contains 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
primeira_lista = ['item1', 'item2', 'item3'] #LISTA DE STRINGS | |
segunda_lista = [1, 2, 3, 4, 5] #LISTA DE NUMEROS INTEIROS | |
terceira_lista = [3.14, 1.4, 6.66, 0.1] #LISTA DE NUMEROS DECIMAIS |
This file contains 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
empresas_tecnologia = ['tesla', 'google', 'dropbox', 'apple', 'nubank'] #List | |
print(empresas_tecnologia[0]) #acessar o index 0 | |
>>>tesla | |
print(empresas_tecnologia[3]) #acessar o index 3 | |
>>>apple | |
print(empresas_tecnologia[-1]) #acessar o item da ultima posição | |
>>>nubank |
This file contains 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
#>>>> Substituindo | |
empresas_tecnologia = ['tesla', 'google', 'dropbox', 'apple', 'nubank'] | |
empresas_tecnologia[4] = 'amazon' #insere 'amazon', substituindo 'nubank' | |
>>>['tesla', 'google', 'dropbox', 'apple', 'amazon'] | |
#>>>>> Adicionando | |
empresas_tecnologia = ['tesla', 'google', 'dropbox', 'apple', 'nubank'] | |
empresas_tecnologia.append('amazon') #adiciona 'amazon' no final da lista |
This file contains 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
#>>>> Removendo itens pela posição | |
empresas_tecnologia = ['tesla', 'google', 'dropbox', 'apple', 'nubank'] | |
del empresas_tecnologia[0] #deleta o index 0 | |
>>>['google', 'dropbox', 'apple', 'nubank'] | |
del empresas_tecnologia[2] #deleta o index 2 | |
>>>['google', 'dropbox', 'nubank'] | |
#>>>>Removendo itens pelo valor |