-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fd00888
commit 7be297a
Showing
84 changed files
with
1,402 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
frutas = ["laranja", "maca", "uva"] | ||
print(frutas) | ||
|
||
frutas = [] | ||
print(frutas) | ||
|
||
letras = list("python") | ||
print(letras) | ||
|
||
numeros = list(range(10)) | ||
print(numeros) | ||
|
||
carro = ["Ferrari", "F8", 4200000, 2020, 2900, "São Paulo", True] | ||
print(carro) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
frutas = ["maçã", "laranja", "uva", "pera"] | ||
|
||
print(frutas[0]) # maçã | ||
print(frutas[2]) # uva |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
frutas = ["maçã", "laranja", "uva", "pera"] | ||
|
||
print(frutas[-1]) # pera | ||
print(frutas[-3]) # laranja |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
matriz = [ | ||
[1, "a", 2], | ||
["b", 3, 4], | ||
[6, 5, "c"] | ||
] | ||
|
||
print(matriz[0]) # [1, "a", 2] | ||
print(matriz[0][0]) # 1 | ||
print(matriz[0][-1]) # 2 | ||
print(matriz[-1][-1]) # "c" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
lista = ["p", "y", "t", "h", "o", "n"] | ||
|
||
print(lista[2:]) # ["t", "h", "o", "n"] | ||
print(lista[:2]) # ["p", "y"] | ||
print(lista[1:3]) # ["y", "t"] | ||
print(lista[0:3:2]) # ["p", "t"] | ||
print(lista[::]) # ["p", "y", "t", "h", "o", "n"] | ||
print(lista[::-1]) # ["n", "o", "h", "t", "y", "p"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
carros = ["gol", "celta", "palio"] | ||
|
||
for carro in carros: | ||
print(carro) | ||
|
||
|
||
for indice, carro in enumerate(carros): | ||
print(f"{indice}: {carro}") |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# Filtrar lista | ||
numeros = [1, 30, 21, 2, 9, 65, 34] | ||
pares = [numero for numero in numeros if numero % 2 == 0] | ||
print(pares) | ||
|
||
# Modificar valores | ||
numeros = [1, 30, 21, 2, 9, 65, 34] | ||
quadrado = [numero**2 for numero in numeros] | ||
print(quadrado) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
lista = [] | ||
|
||
lista.append(1) | ||
lista.append("Python") | ||
lista.append([40, 30, 20]) | ||
|
||
print(lista) # [1, "Python", [40, 30, 20]] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
lista = [1, "Python", [40, 30, 20]] | ||
|
||
print(lista) # [1, "Python", [40, 30, 20]] | ||
|
||
lista.clear() | ||
|
||
print(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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
lista = [1, "Python", [40, 30, 20]] | ||
|
||
lista.copy() | ||
|
||
print(lista) # [1, "Python", [40, 30, 20]] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
cores = ["vermelho", "azul", "verde", "azul"] | ||
|
||
print(cores.count("vermelho")) # 1 | ||
print(cores.count("azul")) # 2 | ||
print(cores.count("verde")) # 1 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
linguagens = ["python", "js", "c"] | ||
|
||
print(linguagens) # ["python", "js", "c"] | ||
|
||
linguagens.extend(["java", "csharp"]) | ||
|
||
print(linguagens) # ["python", "js", "c", "java", "csharp"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
linguagens = ["python", "js", "c", "java", "csharp"] | ||
|
||
print(linguagens.index("java")) # 3 | ||
print(linguagens.index("python")) # 0 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
linguagens = ["python", "js", "c", "java", "csharp"] | ||
|
||
print(linguagens.pop()) # csharp | ||
print(linguagens.pop()) # java | ||
print(linguagens.pop()) # c | ||
print(linguagens.pop(0)) # python |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
linguagens = ["python", "js", "c", "java", "csharp"] | ||
|
||
linguagens.remove("c") | ||
|
||
print(linguagens) # ["python", "js", "java", "csharp"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
linguagens = ["python", "js", "c", "java", "csharp"] | ||
|
||
linguagens.reverse() | ||
|
||
print(linguagens) # ["csharp", "java", "c", "js", "python"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
linguagens = ["python", "js", "c", "java", "csharp"] | ||
linguagens.sort() # ["c", "csharp", "java", "js", "python"] | ||
print(linguagens) | ||
|
||
linguagens = ["python", "js", "c", "java", "csharp"] | ||
linguagens.sort(reverse=True) # ["python", "js", "java", "csharp", "c"] | ||
print(linguagens) | ||
|
||
linguagens = ["python", "js", "c", "java", "csharp"] | ||
linguagens.sort(key=lambda x: len(x)) # ["c", "js", "java", "python", "csharp"] | ||
print(linguagens) | ||
|
||
linguagens = ["python", "js", "c", "java", "csharp"] | ||
linguagens.sort(key=lambda x: len(x), reverse=True) # ["python", "csharp", "java", "js", "c"] | ||
print(linguagens) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
linguagens = ["python", "js", "c", "java", "csharp"] | ||
|
||
print(len(linguagens)) # 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
linguagens = ["python", "js", "c", "java", "csharp"] | ||
|
||
print(sorted(linguagens, key=lambda x: len(x))) # ["c", "js", "java", "python", "csharp"] | ||
print(sorted(linguagens, key=lambda x: len(x), reverse=True)) # ["python", "csharp", "java", "js", "c"] |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
class Bicicleta: | ||
def __init__(self, cor, modelo, ano, valor): | ||
self.cor = cor | ||
self.modelo = modelo | ||
self.ano = ano | ||
self.valor = valor | ||
|
||
def buzinar(self): | ||
print("Plim plim...") | ||
|
||
def parar(self): | ||
print("Parando bicicleta...") | ||
print("Bicicleta parada!") | ||
|
||
def correr(self): | ||
print("Vrummmmm...") | ||
|
||
def __str__(self): | ||
return f"{self.__class__.__name__}: {', '.join([f'{chave}={valor}' for chave, valor in self.__dict__.items()])}" | ||
|
||
|
||
b1 = Bicicleta("vermelha", "caloi", 2022, 600) | ||
b1.buzinar() | ||
b1.correr() | ||
b1.parar() | ||
print(b1.cor, b1.modelo, b1.ano, b1.valor) | ||
|
||
b2 = Bicicleta("verde", "monark", 2000, 189) | ||
print(b2) | ||
b2.correr() |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
frutas = ( | ||
"laranja", | ||
"pera", | ||
"uva", | ||
) | ||
print(frutas) | ||
|
||
letras = tuple("python") | ||
print(letras) | ||
|
||
numeros = tuple([1, 2, 3, 4]) | ||
print(numeros) | ||
|
||
pais = ("Brasil",) | ||
print(pais) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
frutas = ("maçã", "laranja", "uva", "pera",) | ||
|
||
print(frutas[0]) # maçã | ||
print(frutas[2]) # uva |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
frutas = ( | ||
"maçã", | ||
"laranja", | ||
"uva", | ||
"pera", | ||
) | ||
|
||
print(frutas[-1]) # pera | ||
print(frutas[-3]) # laranja |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
matriz = ( | ||
(1, "a", 2), | ||
("b", 3, 4), | ||
(6, 5, "c"), | ||
) | ||
|
||
print(matriz[0]) # (1, "a", 2) | ||
print(matriz[0][0]) # 1 | ||
print(matriz[0][-1]) # 2 | ||
print(matriz[-1][-1]) # "c" |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
tupla = ("p", "y", "t", "h", "o", "n",) | ||
|
||
print(tupla[2:]) # ("t", "h", "o", "n") | ||
print(tupla[:2]) # ("p", "y") | ||
print(tupla[1:3]) # ("y", "t") | ||
print(tupla[0:3:2]) # ("p", "t") | ||
print(tupla[::]) # ("p", "y", "t", "h", "o", "n") | ||
print(tupla[::-1]) # ("n", "o", "h", "t", "y", "p") |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
carros = ( | ||
"gol", | ||
"celta", | ||
"palio", | ||
) | ||
|
||
for carro in carros: | ||
print(carro) | ||
|
||
|
||
for indice, carro in enumerate(carros): | ||
print(f"{indice}: {carro}") |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
cores = ( | ||
"vermelho", | ||
"azul", | ||
"verde", | ||
"azul", | ||
) | ||
|
||
print(cores.count("vermelho")) # 1 | ||
print(cores.count("azul")) # 2 | ||
print(cores.count("verde")) # 1 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
linguagens = ("python", "js", "c", "java", "csharp",) | ||
|
||
print(linguagens.index("java")) # 3 | ||
print(linguagens.index("python")) # 0 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
linguagens = ( | ||
"python", | ||
"js", | ||
"c", | ||
"java", | ||
"csharp", | ||
) | ||
|
||
print(len(linguagens)) # 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
numeros = set([1, 2, 3, 1, 3, 4]) | ||
print(numeros) # {1, 2, 3, 4} | ||
|
||
letras = set("abacaxi") | ||
print(letras) # {"b", "a", "c", "x", "i"} | ||
|
||
carros = set(("palio", "gol", "celta", "palio")) | ||
print(carros) # {"gol", "celta", "palio"} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
numeros = {1, 2, 3, 2} | ||
|
||
numeros = list(numeros) | ||
|
||
print(numeros[0]) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
carros = {"gol", "celta", "palio"} | ||
|
||
for carro in carros: | ||
print(carro) | ||
|
||
for indice, carro in enumerate(carros): | ||
print(f"{indice}: {carro}") |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
conjunto_a = {1, 2} | ||
conjunto_b = {3, 4} | ||
|
||
resultado = conjunto_a.union(conjunto_b) | ||
print(resultado) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
conjunto_a = {1, 2, 3} | ||
conjunto_b = {2, 3, 4} | ||
|
||
resultado = conjunto_a.intersection(conjunto_b) | ||
print(resultado) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
conjunto_a = {1, 2, 3} | ||
conjunto_b = {2, 3, 4} | ||
|
||
resultado = conjunto_a.difference(conjunto_b) | ||
print(resultado) | ||
|
||
resultado = conjunto_b.difference(conjunto_a) | ||
print(resultado) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
conjunto_a = {1, 2, 3} | ||
conjunto_b = {2, 3, 4} | ||
|
||
resultado = conjunto_a.symmetric_difference(conjunto_b) | ||
print(resultado) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
conjunto_a = {1, 2, 3} | ||
conjunto_b = {4, 1, 2, 5, 6, 3} | ||
|
||
resultado = conjunto_a.issubset(conjunto_b) # True | ||
print(resultado) | ||
|
||
resultado = conjunto_b.issubset(conjunto_a) # False | ||
print(resultado) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
conjunto_a = {1, 2, 3} | ||
conjunto_b = {4, 1, 2, 5, 6, 3} | ||
|
||
resultado = conjunto_a.issuperset(conjunto_b) # False | ||
print(resultado) | ||
|
||
resultado = conjunto_b.issuperset(conjunto_a) # True | ||
print(resultado) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
conjunto_a = {1, 2, 3, 4, 5} | ||
conjunto_b = {6, 7, 8, 9} | ||
conjunto_c = {1, 0} | ||
|
||
resultado = conjunto_a.isdisjoint(conjunto_b) # True | ||
print(resultado) | ||
|
||
resultado = conjunto_a.isdisjoint(conjunto_c) # False | ||
print(resultado) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
sorteio = {1, 23} | ||
|
||
sorteio.add(25) # {1, 23, 25} | ||
print(sorteio) | ||
|
||
sorteio.add(42) # {1, 23, 25, 42} | ||
print(sorteio) | ||
|
||
sorteio.add(25) # {1, 23, 25, 42} | ||
print(sorteio) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
sorteio = {1, 23} | ||
|
||
print(sorteio) # {1,23} | ||
|
||
sorteio.clear() | ||
|
||
print(sorteio) # {} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
sorteio = {1, 23} | ||
|
||
print(sorteio) # {1, 23} | ||
|
||
sorteio.copy() | ||
|
||
print(sorteio) # {1, 23} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
numeros = {1, 2, 3, 1, 2, 4, 5, 5, 6, 7, 8, 9, 0} | ||
|
||
print(numeros) # {1, 2, 3, 4, 5, 6, 7, 8, 9, 0} | ||
|
||
numeros.discard(1) | ||
numeros.discard(45) | ||
|
||
print(numeros) # {2, 3, 4, 5, 6, 7, 8, 9, 0} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
numeros = {1, 2, 3, 1, 2, 4, 5, 5, 6, 7, 8, 9, 0} | ||
|
||
print(numeros) # {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} | ||
print(numeros.pop()) # 0 | ||
print(numeros.pop()) # 1 | ||
print(numeros) # {2, 3, 4, 5, 6, 7, 8, 9} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
numeros = {1, 2, 3, 1, 2, 4, 5, 5, 6, 7, 8, 9, 0} | ||
|
||
print(numeros) # {0, 1, 2, 3, 4, 5, 6, 7, 8, 9} | ||
print(numeros.remove(0)) # 0 | ||
print(numeros) # {1, 2, 3, 4, 5, 6, 7, 8, 9} |
Oops, something went wrong.