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'] | |
#>>>>Removendo o ultimo item | |
empresas_tecnologia.pop() # remove o ultimo item da lista | |
>>>['tesla', 'google', 'dropbox', 'apple'] | |
#>>>>removendo o ultimo item e armazenando em uma variavel | |
empresas_brazil = empresas_tecnologia.pop() #remove o ultimo item de 'empresas_tecnologia' e armazena em 'empresas_brazil' | |
print(empresas_brazil) | |
>>>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
empresas_tecnologia = ['tesla', 'google', 'dropbox', 'apple', 'nubank'] | |
empresas_tecnologia.sort() #organiza em ordem alfabética | |
>>> ['apple', 'dropbox', 'google', 'nubank', 'tesla'] | |
empresas_tecnologia.sort(reverse=True) #organiza em ordem alfabética reversa | |
>>> ['tesla', 'nubank', 'google', 'dropbox', 'apple'] | |
empresas_tecnologia.reverse() #organiza em ordem alfabética reversa | |
>>> ['tesla', 'nubank', 'google', 'dropbox', 'apple'] |
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
header1 | header2 | header2 | |
---|---|---|---|
col1 | col2 | col3 |
We can make this file beautiful and searchable if this error is corrected: It looks like row 4 should actually have 2 columns, instead of 1. in line 3.
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
APLICAÇÃO, APLICAÇÃO | |
TRANSPORTE, | |
INTERNET, | |
ENLACE |
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
lista_numerica = list(range(0, 20)) #Gera uma lista de 0 - 20 | |
lista_numerica = list(range(10, 50)) #Gera uma lista de 10 - 50 | |
min(lista_numerica) #Exibe o valor minimo | |
max(lista_numerica) #Exibe o valor maximo | |
sum(lista_numerica) #Exibe a soma de todos os valores |
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
bandas = ['Metallica', 'Slayer', 'Megadeth', 'Anthrax', 'Testament', 'Exodus'] | |
print(bandas[0:3]) #Exibe os três primeiros itens('Metallica', 'Slayer', 'Megadeth') | |
print(bandas[1:4]) #Exibe os itens 1-4 ('Slayer', 'Megadeth', 'Anthrax') | |
print(bandas[:4]) #Exibe os itens a partir do começo até 4 (forma simplificada de "[0:4]") | |
print(bandas[2:]) #Exibe os itens a partir do 2 até o final | |
print(bandas[-2:]) #Exibe os dois ultimos itens, o sinal negativo indica que a contagem é da direita pra esquerda |
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
#>>>> x | |
for numero in range(5): #Para cada numero no intervalo até 5 | |
print(numero) #exibir o numero atual | |
>>> 0 #saidas | |
>>> 1 | |
>>> 2 | |
>>> 3 | |
>>> 4 |
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
for numeros in range(2, 5): #Para cada numero no intervalo de dois até 5 | |
print(numeros) #exibir o numero atual | |
>>> 2 | |
>>> 3 | |
>>> 4 |
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
for numeros in range(2, 10, 3): #Para cada numero no intervalo de 2 até 0, "pular" de dois em dois | |
print(numeros) #exibir o numero atual | |
>>> 2 | |
>>> 8 | |
>>> 5 |
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
for numero in range(10, 5, -1): #Para o intervalo de 10 até 2, decrementar -1 | |
print(numero) | |
>>> 10 | |
>>> 9 | |
>>> 8 | |
>>> 7 | |
>>> 6 |