From 6446969fbd9bcb452c0ce197450cb65acb544c53 Mon Sep 17 00:00:00 2001 From: Tai543 Date: Wed, 12 Oct 2022 19:07:18 -0400 Subject: [PATCH 01/16] Cambios hasta sets --- .gitignore | 3 +- 01-tipos-de-datos/01-booleanos/definicion.py | 10 +++ 01-tipos-de-datos/01-booleanos/mini-test.py | 8 ++ 01-tipos-de-datos/01-booleanos/operadores.py | 15 ++++ .../02-numeros/Enteros/definicion.py | 10 +++ .../OperacionesSimples_I.py | 17 +++++ .../OperacionesSimples_II.py | 0 .../OperacionesNumericas}/Operadores_III.py | 0 .../02-numeros/PuntoFlotante/definicion.py | 11 +++ 01-tipos-de-datos/02-numeros/mini-test.py | 9 +++ .../02-numeros/operaciones_aritmeticas.py | 19 +++++ 01-tipos-de-datos/03-cadenas/definicion.py | 28 +++++++ 01-tipos-de-datos/03-cadenas/mini-test.py | 7 ++ 01-tipos-de-datos/resumen.py | 14 ++++ 02-estructuras-de-datos/01-list/definicion.py | 13 ++++ .../01-list/metodos copy 2.py | 75 +++++++++++++++++++ .../01-list/metodos copy.py | 24 ++++++ 02-estructuras-de-datos/01-list/metodos.py | 22 ++++++ 02-estructuras-de-datos/02-set/definicion.py | 14 ++++ 02-estructuras-de-datos/02-set/metodos.py | 22 ++++++ Cadenas/FuncionSplit.py | 18 +++++ Listas/FuncionesCountIndex.py | 55 ++++++++------ Listas/Indices.py | 27 ++++--- Listas/Segmentacion_III.py | 22 ++++++ OperacionesNumericas/OperacionesSimples_I.py | 18 ----- QuickQuiz/QuizListas.py | 58 ++++++-------- TiposDeVariable/Diccionarios.py | 23 +++--- TiposDeVariable/Type.py | 26 +++---- TiposDeVariable/Variables.py | 31 ++++---- 29 files changed, 471 insertions(+), 128 deletions(-) create mode 100644 01-tipos-de-datos/01-booleanos/definicion.py create mode 100644 01-tipos-de-datos/01-booleanos/mini-test.py create mode 100644 01-tipos-de-datos/01-booleanos/operadores.py create mode 100644 01-tipos-de-datos/02-numeros/Enteros/definicion.py create mode 100644 01-tipos-de-datos/02-numeros/OperacionesNumericas/OperacionesSimples_I.py rename {OperacionesNumericas => 01-tipos-de-datos/02-numeros/OperacionesNumericas}/OperacionesSimples_II.py (100%) rename {OperacionesNumericas => 01-tipos-de-datos/02-numeros/OperacionesNumericas}/Operadores_III.py (100%) create mode 100644 01-tipos-de-datos/02-numeros/PuntoFlotante/definicion.py create mode 100644 01-tipos-de-datos/02-numeros/mini-test.py create mode 100644 01-tipos-de-datos/02-numeros/operaciones_aritmeticas.py create mode 100644 01-tipos-de-datos/03-cadenas/definicion.py create mode 100644 01-tipos-de-datos/03-cadenas/mini-test.py create mode 100644 01-tipos-de-datos/resumen.py create mode 100644 02-estructuras-de-datos/01-list/definicion.py create mode 100644 02-estructuras-de-datos/01-list/metodos copy 2.py create mode 100644 02-estructuras-de-datos/01-list/metodos copy.py create mode 100644 02-estructuras-de-datos/01-list/metodos.py create mode 100644 02-estructuras-de-datos/02-set/definicion.py create mode 100644 02-estructuras-de-datos/02-set/metodos.py create mode 100644 Cadenas/FuncionSplit.py create mode 100644 Listas/Segmentacion_III.py delete mode 100644 OperacionesNumericas/OperacionesSimples_I.py diff --git a/.gitignore b/.gitignore index 5391d87..5bd7933 100644 --- a/.gitignore +++ b/.gitignore @@ -135,4 +135,5 @@ dmypy.json .pytype/ # Cython debug symbols -cython_debug/ \ No newline at end of file +cython_debug/ +.vscode/settings.json diff --git a/01-tipos-de-datos/01-booleanos/definicion.py b/01-tipos-de-datos/01-booleanos/definicion.py new file mode 100644 index 0000000..0464f71 --- /dev/null +++ b/01-tipos-de-datos/01-booleanos/definicion.py @@ -0,0 +1,10 @@ +""" +@author taicoding +Declaremos variables de tipo booleano +""" +verdad = True +print(verdad) +# Resultado: True +falso = False +print(falso) +# Resultado: False diff --git a/01-tipos-de-datos/01-booleanos/mini-test.py b/01-tipos-de-datos/01-booleanos/mini-test.py new file mode 100644 index 0000000..27adb0f --- /dev/null +++ b/01-tipos-de-datos/01-booleanos/mini-test.py @@ -0,0 +1,8 @@ +""" +@author taicoding +Tema: Booleanos +¿Cuál es el resultado? 👩🏻‍🏫👩🏻‍💻 +""" +p = True +q = False +print(not q and (q or p)) diff --git a/01-tipos-de-datos/01-booleanos/operadores.py b/01-tipos-de-datos/01-booleanos/operadores.py new file mode 100644 index 0000000..a141da4 --- /dev/null +++ b/01-tipos-de-datos/01-booleanos/operadores.py @@ -0,0 +1,15 @@ +""" +@author taicoding +Usemos los operadores lógicos 👩🏻‍🏫 +""" +verdad = True +falso = False +# Negación +print(not verdad) +# Resultado: False +# Conjunción u operador 'y' +print(verdad and falso) +# Resultado: False +# Disyunción u operador 'o' +print(verdad or falso) +# Resultado: True diff --git a/01-tipos-de-datos/02-numeros/Enteros/definicion.py b/01-tipos-de-datos/02-numeros/Enteros/definicion.py new file mode 100644 index 0000000..b6711b0 --- /dev/null +++ b/01-tipos-de-datos/02-numeros/Enteros/definicion.py @@ -0,0 +1,10 @@ +""" +@author taicoding +Declaremos variables de tipo entero +""" +edad = 28 +print(edad) +# Resultado: 28 +ahorros = -125 +print(ahorros) +# Resultado: -125 diff --git a/01-tipos-de-datos/02-numeros/OperacionesNumericas/OperacionesSimples_I.py b/01-tipos-de-datos/02-numeros/OperacionesNumericas/OperacionesSimples_I.py new file mode 100644 index 0000000..a030b4a --- /dev/null +++ b/01-tipos-de-datos/02-numeros/OperacionesNumericas/OperacionesSimples_I.py @@ -0,0 +1,17 @@ +""" +@author taicoding +Operadores aritmeticos Parte I +""" +# Definimos las variables con las que realizaremos +# las operaciones aritmeticas +a, b = 8, 3 +# La adiccion o suma se realiza con +# el operador '+' +suma = a + b +print(suma) +# Resultado: 11 +# La sustraccion o resta se realiza con +# el operador '-' +resta = a - b +print(resta) +# Resultado: 5 diff --git a/OperacionesNumericas/OperacionesSimples_II.py b/01-tipos-de-datos/02-numeros/OperacionesNumericas/OperacionesSimples_II.py similarity index 100% rename from OperacionesNumericas/OperacionesSimples_II.py rename to 01-tipos-de-datos/02-numeros/OperacionesNumericas/OperacionesSimples_II.py diff --git a/OperacionesNumericas/Operadores_III.py b/01-tipos-de-datos/02-numeros/OperacionesNumericas/Operadores_III.py similarity index 100% rename from OperacionesNumericas/Operadores_III.py rename to 01-tipos-de-datos/02-numeros/OperacionesNumericas/Operadores_III.py diff --git a/01-tipos-de-datos/02-numeros/PuntoFlotante/definicion.py b/01-tipos-de-datos/02-numeros/PuntoFlotante/definicion.py new file mode 100644 index 0000000..9ab0c70 --- /dev/null +++ b/01-tipos-de-datos/02-numeros/PuntoFlotante/definicion.py @@ -0,0 +1,11 @@ +""" +@author taicoding +Declaremos variables numericas +de punto flotante +""" +pi = 3.141592653589793 +print(pi) +# Resultado: 3.141592653589793 +latitud = -19.0206372 +print(latitud) +# Resultado: -19.0206372 diff --git a/01-tipos-de-datos/02-numeros/mini-test.py b/01-tipos-de-datos/02-numeros/mini-test.py new file mode 100644 index 0000000..70b7c29 --- /dev/null +++ b/01-tipos-de-datos/02-numeros/mini-test.py @@ -0,0 +1,9 @@ +""" +@author taicoding +Tema: Operadores aritméticos +¿Cuál es el resultado? 👩🏻‍🏫👩🏻‍💻🐍 +""" +a = 5 +b = 7 +r = a + b ** 2 - b // a +print(r) diff --git a/01-tipos-de-datos/02-numeros/operaciones_aritmeticas.py b/01-tipos-de-datos/02-numeros/operaciones_aritmeticas.py new file mode 100644 index 0000000..8fa3cc5 --- /dev/null +++ b/01-tipos-de-datos/02-numeros/operaciones_aritmeticas.py @@ -0,0 +1,19 @@ +""" +@author taicoding +Usemos los operadores aritméticos 👩🏻‍🏫👩🏻‍💻🐍 +""" +a, b = 3, 2 +print("Exponenciación:", a ** b) +# Exponenciación: 9 +print("Multiplicación:", a * b) +# Multiplicación: 6 +print("División:", a / b) +# División: 1.5 +print("División entera:", a // b) +# División entera: 1 +print("Modulo:", a % b) +# Modulo: 1 +print("Adición:", a + b) +# Adición: 5 +print("Sustracción:", a - b) +# Sustracción: 1 diff --git a/01-tipos-de-datos/03-cadenas/definicion.py b/01-tipos-de-datos/03-cadenas/definicion.py new file mode 100644 index 0000000..74d6f48 --- /dev/null +++ b/01-tipos-de-datos/03-cadenas/definicion.py @@ -0,0 +1,28 @@ +""" +@author taicoding +Declaremos variables de tipo cadena +""" +# Comillas simples +simple = "Soy una cadena uwu" +print(simple) +# Resultado: Soy una cadenas +# Comillas dobles +doble = "Una secuencia de caracteres" +print(doble) +# Resultado: Una secuencia de caracteres +# Metodo de cadena +metodo = str("Soy inmutable uwu") +print(metodo) +# Resultado: Soy inmutable uwu +# Multiples lineas +multilinea = """Puedes declararme +de varias formas +owo uwu awa""" +print(multilinea) +# Resultado: Puedes declararme +# de varias formas +# owo uwu awa +# Concatenación +concatenando = "¡Python" + " es cool!" +print(concatenando) +# Resultado: ¡Python es cool! diff --git a/01-tipos-de-datos/03-cadenas/mini-test.py b/01-tipos-de-datos/03-cadenas/mini-test.py new file mode 100644 index 0000000..13e5e79 --- /dev/null +++ b/01-tipos-de-datos/03-cadenas/mini-test.py @@ -0,0 +1,7 @@ +""" +@author taicoding +Tema: Cadenas +¿Cuál es el resultado? 👩🏻‍🏫👩🏻‍💻🐍 +""" +cadena = "Python \nis \nCool!" +print(cadena) diff --git a/01-tipos-de-datos/resumen.py b/01-tipos-de-datos/resumen.py new file mode 100644 index 0000000..b0bb558 --- /dev/null +++ b/01-tipos-de-datos/resumen.py @@ -0,0 +1,14 @@ +""" +@author taicoding +¿Cómo definir variables en Python? 🐍👩🏻‍🏫👩🏻‍💻 +Primero le damos un nombre a la variable +y luego le asignamos un valor. +""" +# El valor puede ser booleano +estudiante = False +# El valor puede ser un número entero +edad = 29 +# El valor puede ser un número con parte decimal +estatura = 1.65 +# El valor pude ser una cadena +nombre = "Tatiana" diff --git a/02-estructuras-de-datos/01-list/definicion.py b/02-estructuras-de-datos/01-list/definicion.py new file mode 100644 index 0000000..8f2d80f --- /dev/null +++ b/02-estructuras-de-datos/01-list/definicion.py @@ -0,0 +1,13 @@ +""" +@author taicoding +Formas de declarar una lista +""" +# Sin elementos +likes = [] +seguidores = list() +# Con elementos +letras = list(["P", "Y", "T", "H", "O", "N", 3.9, 4]) +emociones = ["u_u", "uwu", "o_o", "uwu"] +# Bonus: ✨ Veamos el tipo ✨ +print(type(emociones)) +# R: diff --git a/02-estructuras-de-datos/01-list/metodos copy 2.py b/02-estructuras-de-datos/01-list/metodos copy 2.py new file mode 100644 index 0000000..70e17ba --- /dev/null +++ b/02-estructuras-de-datos/01-list/metodos copy 2.py @@ -0,0 +1,75 @@ +""" +@author taicoding +Metodos de Listas 🐍 +""" +# Lista inicial +emociones = ["uwu"] +# ⭐️ Agregar un elemento ⭐️ +# append(elemento) +emociones.append("owo") +print(emociones) +# R: ['uwu', 'owo'] +# ⭐️ Tip: append es la forma mas rapida +""" +@author taicoding +Metodos de Listas 🐍 +""" +# Lista inicial +emociones = ["uwu", "owo"] +# ⭐️ Agregar un elemento ⭐️ +# insert(indice,elemento) +emociones.insert(1, "e_e") +print(emociones) +# R: ['uwu', 'e_e', 'owo'] +""" +@author taicoding +Metodos de Listas 🐍 +""" +# Lista inicial +emociones = ["uwu", "e_e", "owo"] +# concatenacion de listas +emociones = emociones + ["o_o"] +print(emociones) +# R: ['uwu', 'e_e', 'owo', 'o_o'] +""" +@author taicoding +Metodos de Listas 🐍 +""" +# Lista inicial +emociones = ["uwu", "o_o", "e_e", "owo"] +# ⭐️ Remueve un elemento ⭐️ +# remove(elemento) +emociones.remove("o_o") +print(emociones) +# R: ['uwu', 'e_e', 'owo'] +""" +@author taicoding +Metodos de Listas 🐍 +""" +# Lista inicial +emociones = ["uwu", "e_e", "owo"] +# ⭐️ Revertir la Lista ⭐️ +emociones.reverse() +print(emociones) +# R: ['owo', 'e_e', 'uwu'] +""" +@author taicoding +Metodos de Listas 🐍 +""" +# Lista inicial +emociones = ["owo", "e_e", "uwu"] +# ⭐️ Ordenar la Lista ⭐️ +emociones.sort() +print(emociones) +# R: ['e_e', 'owo', 'uwu'] +""" +@author taicoding +Metodos de Listas 🐍 +""" +# Lista inicial +emociones = ["e_e", "owo", "uwu"] +# ⭐️ Indice de un elemento ⭐️ +# index(elemento) +i = emociones.index("owo") +print(i) +# R: 1 diff --git a/02-estructuras-de-datos/01-list/metodos copy.py b/02-estructuras-de-datos/01-list/metodos copy.py new file mode 100644 index 0000000..a8d66ab --- /dev/null +++ b/02-estructuras-de-datos/01-list/metodos copy.py @@ -0,0 +1,24 @@ +""" +@author taicoding +Metodos de Listas 🐍 Parte II +""" +# Lista inicial +emociones = ["uwu", "o_o", "e_e", "owo"] +# ⭐️ Remueve un elemento ⭐️ +# remove(elemento) +emociones.remove("o_o") +print(emociones) +# R: ['uwu', 'e_e', 'owo'] +# ⭐️ Revertir la Lista ⭐️ +emociones.reverse() +print(emociones) +# R: ['owo', 'e_e', 'uwu'] +# ⭐️ Ordenar la Lista ⭐️ +emociones.sort() +print(emociones) +# R: ['e_e', 'owo', 'uwu'] +# ⭐️ Indice de un elemento ⭐️ +# index(elemento) +i = emociones.index("owo") +print(i) +# R: 1 diff --git a/02-estructuras-de-datos/01-list/metodos.py b/02-estructuras-de-datos/01-list/metodos.py new file mode 100644 index 0000000..6d6fadf --- /dev/null +++ b/02-estructuras-de-datos/01-list/metodos.py @@ -0,0 +1,22 @@ +""" +@author taicoding +Metodos de Listas 🐍 Parte I +""" +# Lista inicial +emociones = ["uwu"] +# ⭐️ Agregar un elemento ⭐️ +# append(elemento) +emociones.append("owo") +print(emociones) +# R: ['uwu', 'owo'] +# ⭐️ Agregar un elemento ⭐️ +# insert(indice,elemento) +emociones.insert(1, "e_e") +print(emociones) +# R: ['uwu', 'e_e', 'owo'] +# concatenacion de listas +emociones = emociones + ["o_o"] +print(emociones) +# R: ['uwu', 'e_e', 'owo', 'o_o'] +# ⭐️ Tip +# ⭐️ append es la forma mas rapida diff --git a/02-estructuras-de-datos/02-set/definicion.py b/02-estructuras-de-datos/02-set/definicion.py new file mode 100644 index 0000000..4207d78 --- /dev/null +++ b/02-estructuras-de-datos/02-set/definicion.py @@ -0,0 +1,14 @@ +""" +@author taicoding +Formas de declarar un set 🐍 +""" +# Sin elementos +numeros = {} +verduras = set() +# Con elementos +frutas = set(["pera", "uva", "sandia"]) +pares = {22, 44, 66, 88, 100} +# Bonus: ✨ Veamos el tipo ✨ +print(type(numeros)) +# R: +pares. \ No newline at end of file diff --git a/02-estructuras-de-datos/02-set/metodos.py b/02-estructuras-de-datos/02-set/metodos.py new file mode 100644 index 0000000..7f80a93 --- /dev/null +++ b/02-estructuras-de-datos/02-set/metodos.py @@ -0,0 +1,22 @@ +""" +@author taicoding +Metodos de Sets 🐍 +""" +# Lista inicial +emociones = ["uwu"] +# ⭐️ Agregar un elemento ⭐️ +# append(elemento) +emociones.append("owo") +print(emociones) +# R: ['uwu', 'owo'] +# ⭐️ Agregar un elemento ⭐️ +# insert(indice,elemento) +emociones.insert(1, "e_e") +print(emociones) +# R: ['uwu', 'e_e', 'owo'] +# concatenacion de listas +emociones = emociones + ["o_o"] +print(emociones) +# R: ['uwu', 'e_e', 'owo', 'o_o'] +# ⭐️ Tip +# ⭐️ append es la forma mas rapida diff --git a/Cadenas/FuncionSplit.py b/Cadenas/FuncionSplit.py new file mode 100644 index 0000000..8093499 --- /dev/null +++ b/Cadenas/FuncionSplit.py @@ -0,0 +1,18 @@ +""" +@author taicoding +Funciones con cadenas parte IV +Función split() +""" +# Definimos una cadena +cadena = "soy uwu cadena" +print(cadena) +# Resultado: soy uwu cadena +""" +Vamos a convertir esta cadena en +cadenas más pequeñas usando la +función split() que por defecto divide +la cadena en cada espacio en blanco +""" +cadenas = cadena.split(" ") +print(cadenas) +# Resultado: ['soy', 'uwu', 'cadena'] diff --git a/Listas/FuncionesCountIndex.py b/Listas/FuncionesCountIndex.py index b92acfb..dc65652 100644 --- a/Listas/FuncionesCountIndex.py +++ b/Listas/FuncionesCountIndex.py @@ -1,42 +1,53 @@ -''' +""" @author taicoding -Funciones de Listas -Veamos funciones utiles para manejar listas -''' +Listas +Dividir una lista en 2 +""" # En 'emociones' vamos a definir una lista -emociones = list(['u_u','uwu','o_o','uwu']) +emociones = list( + [ + "u_u", + "uwu", + "u.u", + "o_o", + "owo", + "o.o", + ] +) print(emociones) -# Resultado: ['u_u', 'uwu', 'o_o', 'uwu'] -# Con la funcion 'count()' vamos a contar el numero +# Resultado: ['u_u', 'uwu', 'u.u', 'o_o', 'owo', 'o.o'] +# Es muy facil divir una lista +# Primero encontramos + +# Con la funcion 'count()' vamos a contar el numero # de veces que 'uwu' aparece en la lista 'emociones' -nro_uwus = emociones.count('uwu') +nro_uwus = emociones.count("uwu") print(nro_uwus) # Resultado: 2 -# Con la funcion 'index()' vamos a obtener la posicion +# Con la funcion 'index()' vamos a obtener la posicion # de 'uwu' en la lista 'emociones' -posicion_uwu = emociones.index('uwu') +posicion_uwu = emociones.index("uwu") print(posicion_uwu) # Resultado: 1 -#🛑 Si te diste cuenta tenemos 2 'uwu' en la lista 🛑 -# Si los elementos de una lista se repiten la funcion -# 'index()' solo nos devolvera la posicion de la +# 🛑 Si te diste cuenta tenemos 2 'uwu' en la lista 🛑 +# Si los elementos de una lista se repiten la funcion +# 'index()' solo nos devolvera la posicion de la # primera aparicion del elemento 👩🏻‍🏫👩🏻‍💻 - -''' +""" @author taicoding Funciones de Listas Veamos funciones utiles para manejar listas -''' +""" # Vamos a definir la listas 'awa' -awa = ['awa','de','uwu'] -# En la lista 'emociones' vamos a copiar la lista +awa = ["awa", "de", "uwu"] +# En la lista 'emociones' vamos a copiar la lista # 'awa' usando el operador '=' emociones = awa print(emociones) # Resultado: ['awa', 'de', 'uwu'] -# Vamos a revertir la lista emociones con la funcion +# Vamos a revertir la lista emociones con la funcion # 'reverse()' y veremos que paso con la lista 'awa' emociones.reverse() print(emociones) @@ -44,8 +55,6 @@ print(awa) # Resultado: ['uwu', 'de', 'awa'] # 🛑🙀 Oh no! ambas listas fueron modificadas -# Cuando usamos el operador '=' las lista -# involucradas se convierten en un espejo de +# Cuando usamos el operador '=' las lista +# involucradas se convierten en un espejo de # la otra 👩🏻‍🏫👩🏻‍💻🛑 - - diff --git a/Listas/Indices.py b/Listas/Indices.py index 285d015..191f94b 100644 --- a/Listas/Indices.py +++ b/Listas/Indices.py @@ -1,12 +1,12 @@ -''' +""" @author taicoding -Listas: Indices -''' +¿Cómo funcionan los índices de las listas? 🐍 +""" # Definamos la lista 'python' -python = ['P','Y','T','H','O','N'] -# Los indices de los elementos de la lista -# 'python' se pueden leer de las siguientes formas -''' +python = ["P", "Y", "T", "H", "O", "N"] +# Los indices de los elementos de la lista +# 'python' se pueden leer de las siguientes formas +""" +---+---+---+---+---+---+ | P | Y | T | H | O | N | +---+---+---+---+---+---+ indices @@ -14,10 +14,19 @@ +---+---+---+---+---+---+ indices |-6 |-5 |-4 |-3 |-2 |-1 | <<-- derecha a izquierda +---+---+---+---+---+---+ -''' +""" # Mostremos el primer elemento de la lista 'python' # usando ambos tipos de indices 😎👩🏻‍🏫👩🏻‍💻 print(python[0]) # Resultado: P print(python[-6]) -# Resultado: P \ No newline at end of file +# Resultado: P + +""" +@author taicoding +""" +from datetime import date + +if str(date.today()) == "2022-09-13": + print("¡Feliz día del programador!") + print("¡Feliz día de la programadora!") diff --git a/Listas/Segmentacion_III.py b/Listas/Segmentacion_III.py new file mode 100644 index 0000000..44ed1cf --- /dev/null +++ b/Listas/Segmentacion_III.py @@ -0,0 +1,22 @@ +""" +@author taicoding +Listas: Segmentacion III +""" +# En 'emociones' vamos a definir una lista +emociones = list(["u_u", "uwu", "o_o", "uwu"]) +print(emociones) +# Resultado: ['u_u', 'uwu', 'o_o', 'uwu'] +# Ahora vamos a dividir esta lista en dos +# Encontramos la cantidad de elementos de la lista +longitud = len(emociones) +# Con una division entera encontramos la mitad de la +# 'longitud' +medio = longitud // 2 +# Utilizando la sergmentacion delimitamos +# las dos mitades de nuesta lista +una_mitad = emociones[:medio] +otra_mitad = emociones[medio:] +print(una_mitad) +# Resultado: ['u_u', 'uwu'] +print(otra_mitad) +# Resultado: ['o_o', 'uwu'] diff --git a/OperacionesNumericas/OperacionesSimples_I.py b/OperacionesNumericas/OperacionesSimples_I.py deleted file mode 100644 index efcb0df..0000000 --- a/OperacionesNumericas/OperacionesSimples_I.py +++ /dev/null @@ -1,18 +0,0 @@ -''' -@author taicoding -Operadores aritmeticos Parte I -''' -#Definimos las variables con las que realizaremos -#las operaciones aritmeticas -a = 8 -b = 3 -#La adiccion o suma se realiza con -#el operador '+' -suma = a + b -print(suma) -#Resultado: 11 -#La sustraccion o resta se realiza con -#el operador '-' -resta = a - b -print(resta) -#Resultado: 5 diff --git a/QuickQuiz/QuizListas.py b/QuickQuiz/QuizListas.py index c81c150..7a67ed0 100644 --- a/QuickQuiz/QuizListas.py +++ b/QuickQuiz/QuizListas.py @@ -1,63 +1,49 @@ -''' +""" @author taicoding Quick Quiz de Listas -''' -python = [1,2,3,4,5,6] +""" +python = [1, 2, 3, 4, 5, 6] print(python[2:5]) -''' +""" @author taicoding Quick Quiz de Listas -''' -python = [1,2,3,4,5,6] +""" +python = [1, 2, 3, 4, 5, 6] print(python[-3:-1]) -''' +""" @author taicoding Quick Quiz de Listas -''' -postre = ['P','I','E'] +""" +postre = ["P", "I", "E"] print(postre[0:1]) -''' +""" @author taicoding Quick Quiz -''' -cadena = '¡Hola mundo!' +""" +cadena = "¡Hola mundo!" print(len(cadena)) -''' +""" @author taicoding Quick Quiz -''' -cadena = '¡Hola' -sub_cadena ='Hola' +""" +cadena = "¡Hola" +sub_cadena = "Hola" if sub_cadena in cadena: - print('¡Hola mundo!') + print("¡Hola mundo!") else: - print('Bye') + print("Bye") -''' +""" @author taicoding Quick Quiz -''' +""" num = 12 if num % 2 == 0: - print('par') + print("par") else: - print('impar') - - - - - - - - - - - - - - + print("impar") diff --git a/TiposDeVariable/Diccionarios.py b/TiposDeVariable/Diccionarios.py index d74ccb3..fd26b8c 100644 --- a/TiposDeVariable/Diccionarios.py +++ b/TiposDeVariable/Diccionarios.py @@ -1,22 +1,23 @@ -''' +""" @author taicoding Tipos de Variables: Diccionarios Los diccionarios son estructuras de datos y un tipo de dato que nos permite almacenar cualquier tipo de dato -''' -# Para definir los elementos de un diccionario utilizamos +""" +# Para definir los elementos de un diccionario utilizamos # el formato 'llave:valor' donde cada 'llave' es unica -instagram = {'nombre':'taicoding','edad':'27' - ,'progreso':0.5 - , 'seguidores':['uwu' - ,'sin' - ,'ewe']} +instagram = { + "nombre": "taicoding", + "edad": "27", + "progreso": 0.5, + "seguidores": ["uwu", "sin", "ewe"], +} print(type(instagram)) # Resultado: # Vamos a acceder al valor de la llave 'nombre' # de nuestro diccionario -print(instagram['nombre']) +print(instagram["nombre"]) # Resultado: taicoding # Ahora vamos a acceder al valor de la llave 'seguidores' -print(instagram['seguidores']) -# Resultado: ['uwu', 'sin', 'ewe'] \ No newline at end of file +print(instagram["seguidores"]) +# Resultado: ['uwu', 'sin', 'ewe'] diff --git a/TiposDeVariable/Type.py b/TiposDeVariable/Type.py index 367909a..ed73210 100644 --- a/TiposDeVariable/Type.py +++ b/TiposDeVariable/Type.py @@ -1,20 +1,18 @@ -''' +""" @author taicoding ¿Para que sirve la funcion type en Python? -''' -#Nos permite ver el tipo de la varible -#que definimos -nombre='Tatiana' +""" +# Nos permite ver el tipo de la varible +# que definimos +nombre = "Tatiana" print(type(nombre)) -#Resultado: -edad=27 +# Resultado: +edad = 27 print(type(edad)) -#Resultado: -estatura=1.65 +# Resultado: +estatura = 1.65 print(type(estatura)) -#Resultado: -casada=False +# Resultado: +casada = False print(type(casada)) -#Resultado: - - +# Resultado: diff --git a/TiposDeVariable/Variables.py b/TiposDeVariable/Variables.py index 2183b94..4153db3 100644 --- a/TiposDeVariable/Variables.py +++ b/TiposDeVariable/Variables.py @@ -1,21 +1,20 @@ -''' +""" @author taicoding ¿Como definir variables en Python? -''' -''' +""" +""" Para definir variable solo necesitamos el nombre de la varible y asignar un valor -''' -#El valor pude ser una cadena -nombre='Tatiana' -#El valor puede ser un caracter -tipoSangre='A' -#El valor puede ser un numero entero -edad=27 -#El valor puede ser un numero -#con punto flotante -estatura=1.65 -#El valor puede ser booleano -casada=False - +""" +# El valor pude ser una cadena +nombre = "Tatiana" +# El valor puede ser un caracter +tipoSangre = "A" +# El valor puede ser un numero entero +edad = 27 +# El valor puede ser un numero +# con punto flotante +estatura = 1.65 +# El valor puede ser booleano +casada = False From df750c604031e0587a4b77d75259a439f8c4a2fb Mon Sep 17 00:00:00 2001 From: Tai543 Date: Sun, 16 Oct 2022 19:46:59 -0400 Subject: [PATCH 02/16] PEP* en folders y unificacion de archivos --- .../01_booleanos}/definicion.py | 0 .../01_booleanos/mini_test.py | 0 .../01_booleanos}/operadores.py | 0 .../02_numeros/01-enteros}/definicion.py | 0 .../02-punto-flotante}/definicion.py | 0 .../OperacionesSimples_I.py | 0 .../OperacionesSimples_II.py | 0 .../Operadores_III.py | 0 .../02_numeros}/mini-test.py | 0 .../02_numeros}/operaciones_aritmeticas.py | 0 .../03_cadenas}/definicion.py | 0 .../03_cadenas}/mini-test.py | 0 .../resumen.py | 0 .../01-list/metodos copy.py | 24 --------- 02-estructuras-de-datos/01-list/metodos.py | 22 --------- .../01_listas}/definicion.py | 0 .../01_listas/metodos.py | 49 ++++--------------- .../02_conjuntos}/definicion.py | 0 .../02_conjuntos}/metodos.py | 0 19 files changed, 10 insertions(+), 85 deletions(-) rename {01-tipos-de-datos/01-booleanos => 01_tipos_de_datos/01_booleanos}/definicion.py (100%) rename 01-tipos-de-datos/01-booleanos/mini-test.py => 01_tipos_de_datos/01_booleanos/mini_test.py (100%) rename {01-tipos-de-datos/01-booleanos => 01_tipos_de_datos/01_booleanos}/operadores.py (100%) rename {01-tipos-de-datos/02-numeros/Enteros => 01_tipos_de_datos/02_numeros/01-enteros}/definicion.py (100%) rename {01-tipos-de-datos/02-numeros/PuntoFlotante => 01_tipos_de_datos/02_numeros/02-punto-flotante}/definicion.py (100%) rename {01-tipos-de-datos/02-numeros/OperacionesNumericas => 01_tipos_de_datos/02_numeros/03-operaciones-numericas}/OperacionesSimples_I.py (100%) rename {01-tipos-de-datos/02-numeros/OperacionesNumericas => 01_tipos_de_datos/02_numeros/03-operaciones-numericas}/OperacionesSimples_II.py (100%) rename {01-tipos-de-datos/02-numeros/OperacionesNumericas => 01_tipos_de_datos/02_numeros/03-operaciones-numericas}/Operadores_III.py (100%) rename {01-tipos-de-datos/02-numeros => 01_tipos_de_datos/02_numeros}/mini-test.py (100%) rename {01-tipos-de-datos/02-numeros => 01_tipos_de_datos/02_numeros}/operaciones_aritmeticas.py (100%) rename {01-tipos-de-datos/03-cadenas => 01_tipos_de_datos/03_cadenas}/definicion.py (100%) rename {01-tipos-de-datos/03-cadenas => 01_tipos_de_datos/03_cadenas}/mini-test.py (100%) rename {01-tipos-de-datos => 01_tipos_de_datos}/resumen.py (100%) delete mode 100644 02-estructuras-de-datos/01-list/metodos copy.py delete mode 100644 02-estructuras-de-datos/01-list/metodos.py rename {02-estructuras-de-datos/01-list => 02_estructuras_de_datos/01_listas}/definicion.py (100%) rename 02-estructuras-de-datos/01-list/metodos copy 2.py => 02_estructuras_de_datos/01_listas/metodos.py (54%) rename {02-estructuras-de-datos/02-set => 02_estructuras_de_datos/02_conjuntos}/definicion.py (100%) rename {02-estructuras-de-datos/02-set => 02_estructuras_de_datos/02_conjuntos}/metodos.py (100%) diff --git a/01-tipos-de-datos/01-booleanos/definicion.py b/01_tipos_de_datos/01_booleanos/definicion.py similarity index 100% rename from 01-tipos-de-datos/01-booleanos/definicion.py rename to 01_tipos_de_datos/01_booleanos/definicion.py diff --git a/01-tipos-de-datos/01-booleanos/mini-test.py b/01_tipos_de_datos/01_booleanos/mini_test.py similarity index 100% rename from 01-tipos-de-datos/01-booleanos/mini-test.py rename to 01_tipos_de_datos/01_booleanos/mini_test.py diff --git a/01-tipos-de-datos/01-booleanos/operadores.py b/01_tipos_de_datos/01_booleanos/operadores.py similarity index 100% rename from 01-tipos-de-datos/01-booleanos/operadores.py rename to 01_tipos_de_datos/01_booleanos/operadores.py diff --git a/01-tipos-de-datos/02-numeros/Enteros/definicion.py b/01_tipos_de_datos/02_numeros/01-enteros/definicion.py similarity index 100% rename from 01-tipos-de-datos/02-numeros/Enteros/definicion.py rename to 01_tipos_de_datos/02_numeros/01-enteros/definicion.py diff --git a/01-tipos-de-datos/02-numeros/PuntoFlotante/definicion.py b/01_tipos_de_datos/02_numeros/02-punto-flotante/definicion.py similarity index 100% rename from 01-tipos-de-datos/02-numeros/PuntoFlotante/definicion.py rename to 01_tipos_de_datos/02_numeros/02-punto-flotante/definicion.py diff --git a/01-tipos-de-datos/02-numeros/OperacionesNumericas/OperacionesSimples_I.py b/01_tipos_de_datos/02_numeros/03-operaciones-numericas/OperacionesSimples_I.py similarity index 100% rename from 01-tipos-de-datos/02-numeros/OperacionesNumericas/OperacionesSimples_I.py rename to 01_tipos_de_datos/02_numeros/03-operaciones-numericas/OperacionesSimples_I.py diff --git a/01-tipos-de-datos/02-numeros/OperacionesNumericas/OperacionesSimples_II.py b/01_tipos_de_datos/02_numeros/03-operaciones-numericas/OperacionesSimples_II.py similarity index 100% rename from 01-tipos-de-datos/02-numeros/OperacionesNumericas/OperacionesSimples_II.py rename to 01_tipos_de_datos/02_numeros/03-operaciones-numericas/OperacionesSimples_II.py diff --git a/01-tipos-de-datos/02-numeros/OperacionesNumericas/Operadores_III.py b/01_tipos_de_datos/02_numeros/03-operaciones-numericas/Operadores_III.py similarity index 100% rename from 01-tipos-de-datos/02-numeros/OperacionesNumericas/Operadores_III.py rename to 01_tipos_de_datos/02_numeros/03-operaciones-numericas/Operadores_III.py diff --git a/01-tipos-de-datos/02-numeros/mini-test.py b/01_tipos_de_datos/02_numeros/mini-test.py similarity index 100% rename from 01-tipos-de-datos/02-numeros/mini-test.py rename to 01_tipos_de_datos/02_numeros/mini-test.py diff --git a/01-tipos-de-datos/02-numeros/operaciones_aritmeticas.py b/01_tipos_de_datos/02_numeros/operaciones_aritmeticas.py similarity index 100% rename from 01-tipos-de-datos/02-numeros/operaciones_aritmeticas.py rename to 01_tipos_de_datos/02_numeros/operaciones_aritmeticas.py diff --git a/01-tipos-de-datos/03-cadenas/definicion.py b/01_tipos_de_datos/03_cadenas/definicion.py similarity index 100% rename from 01-tipos-de-datos/03-cadenas/definicion.py rename to 01_tipos_de_datos/03_cadenas/definicion.py diff --git a/01-tipos-de-datos/03-cadenas/mini-test.py b/01_tipos_de_datos/03_cadenas/mini-test.py similarity index 100% rename from 01-tipos-de-datos/03-cadenas/mini-test.py rename to 01_tipos_de_datos/03_cadenas/mini-test.py diff --git a/01-tipos-de-datos/resumen.py b/01_tipos_de_datos/resumen.py similarity index 100% rename from 01-tipos-de-datos/resumen.py rename to 01_tipos_de_datos/resumen.py diff --git a/02-estructuras-de-datos/01-list/metodos copy.py b/02-estructuras-de-datos/01-list/metodos copy.py deleted file mode 100644 index a8d66ab..0000000 --- a/02-estructuras-de-datos/01-list/metodos copy.py +++ /dev/null @@ -1,24 +0,0 @@ -""" -@author taicoding -Metodos de Listas 🐍 Parte II -""" -# Lista inicial -emociones = ["uwu", "o_o", "e_e", "owo"] -# ⭐️ Remueve un elemento ⭐️ -# remove(elemento) -emociones.remove("o_o") -print(emociones) -# R: ['uwu', 'e_e', 'owo'] -# ⭐️ Revertir la Lista ⭐️ -emociones.reverse() -print(emociones) -# R: ['owo', 'e_e', 'uwu'] -# ⭐️ Ordenar la Lista ⭐️ -emociones.sort() -print(emociones) -# R: ['e_e', 'owo', 'uwu'] -# ⭐️ Indice de un elemento ⭐️ -# index(elemento) -i = emociones.index("owo") -print(i) -# R: 1 diff --git a/02-estructuras-de-datos/01-list/metodos.py b/02-estructuras-de-datos/01-list/metodos.py deleted file mode 100644 index 6d6fadf..0000000 --- a/02-estructuras-de-datos/01-list/metodos.py +++ /dev/null @@ -1,22 +0,0 @@ -""" -@author taicoding -Metodos de Listas 🐍 Parte I -""" -# Lista inicial -emociones = ["uwu"] -# ⭐️ Agregar un elemento ⭐️ -# append(elemento) -emociones.append("owo") -print(emociones) -# R: ['uwu', 'owo'] -# ⭐️ Agregar un elemento ⭐️ -# insert(indice,elemento) -emociones.insert(1, "e_e") -print(emociones) -# R: ['uwu', 'e_e', 'owo'] -# concatenacion de listas -emociones = emociones + ["o_o"] -print(emociones) -# R: ['uwu', 'e_e', 'owo', 'o_o'] -# ⭐️ Tip -# ⭐️ append es la forma mas rapida diff --git a/02-estructuras-de-datos/01-list/definicion.py b/02_estructuras_de_datos/01_listas/definicion.py similarity index 100% rename from 02-estructuras-de-datos/01-list/definicion.py rename to 02_estructuras_de_datos/01_listas/definicion.py diff --git a/02-estructuras-de-datos/01-list/metodos copy 2.py b/02_estructuras_de_datos/01_listas/metodos.py similarity index 54% rename from 02-estructuras-de-datos/01-list/metodos copy 2.py rename to 02_estructuras_de_datos/01_listas/metodos.py index 70e17ba..cde1b36 100644 --- a/02-estructuras-de-datos/01-list/metodos copy 2.py +++ b/02_estructuras_de_datos/01_listas/metodos.py @@ -1,6 +1,6 @@ """ @author taicoding -Metodos de Listas 🐍 +Métodos de Listas 🐍 """ # Lista inicial emociones = ["uwu"] @@ -9,65 +9,36 @@ emociones.append("owo") print(emociones) # R: ['uwu', 'owo'] -# ⭐️ Tip: append es la forma mas rapida -""" -@author taicoding -Metodos de Listas 🐍 -""" -# Lista inicial -emociones = ["uwu", "owo"] +# ⭐️ Tip: append es la forma mas rápida + # ⭐️ Agregar un elemento ⭐️ # insert(indice,elemento) emociones.insert(1, "e_e") print(emociones) # R: ['uwu', 'e_e', 'owo'] -""" -@author taicoding -Metodos de Listas 🐍 -""" -# Lista inicial -emociones = ["uwu", "e_e", "owo"] -# concatenacion de listas + +# concatenación de listas emociones = emociones + ["o_o"] print(emociones) # R: ['uwu', 'e_e', 'owo', 'o_o'] -""" -@author taicoding -Metodos de Listas 🐍 -""" -# Lista inicial -emociones = ["uwu", "o_o", "e_e", "owo"] + # ⭐️ Remueve un elemento ⭐️ # remove(elemento) emociones.remove("o_o") print(emociones) # R: ['uwu', 'e_e', 'owo'] -""" -@author taicoding -Metodos de Listas 🐍 -""" -# Lista inicial -emociones = ["uwu", "e_e", "owo"] + # ⭐️ Revertir la Lista ⭐️ emociones.reverse() print(emociones) # R: ['owo', 'e_e', 'uwu'] -""" -@author taicoding -Metodos de Listas 🐍 -""" -# Lista inicial -emociones = ["owo", "e_e", "uwu"] + # ⭐️ Ordenar la Lista ⭐️ emociones.sort() print(emociones) # R: ['e_e', 'owo', 'uwu'] -""" -@author taicoding -Metodos de Listas 🐍 -""" -# Lista inicial -emociones = ["e_e", "owo", "uwu"] + + # ⭐️ Indice de un elemento ⭐️ # index(elemento) i = emociones.index("owo") diff --git a/02-estructuras-de-datos/02-set/definicion.py b/02_estructuras_de_datos/02_conjuntos/definicion.py similarity index 100% rename from 02-estructuras-de-datos/02-set/definicion.py rename to 02_estructuras_de_datos/02_conjuntos/definicion.py diff --git a/02-estructuras-de-datos/02-set/metodos.py b/02_estructuras_de_datos/02_conjuntos/metodos.py similarity index 100% rename from 02-estructuras-de-datos/02-set/metodos.py rename to 02_estructuras_de_datos/02_conjuntos/metodos.py From c520517c1c4ea3e565c18de181e524712247ba40 Mon Sep 17 00:00:00 2001 From: Tai543 Date: Wed, 19 Oct 2022 00:30:19 -0400 Subject: [PATCH 03/16] Updating file sctructure --- 02_estructuras_de_datos/03_diccionarios/definicion.py | 1 + 02_estructuras_de_datos/03_diccionarios/metodos.py | 0 02_estructuras_de_datos/04_tuplas/definicion.py | 1 + 02_estructuras_de_datos/04_tuplas/metodos.py | 0 03_sentencias_condicionales/definicion.py | 1 + 04_estructuras_de_iteracion/01_while/definicion.py | 1 + 04_estructuras_de_iteracion/02_for/definicion.py | 1 + 05_funciones/definicion.py | 1 + 06_clases/definicion.py | 1 + 9 files changed, 7 insertions(+) create mode 100644 02_estructuras_de_datos/03_diccionarios/definicion.py create mode 100644 02_estructuras_de_datos/03_diccionarios/metodos.py create mode 100644 02_estructuras_de_datos/04_tuplas/definicion.py create mode 100644 02_estructuras_de_datos/04_tuplas/metodos.py create mode 100644 03_sentencias_condicionales/definicion.py create mode 100644 04_estructuras_de_iteracion/01_while/definicion.py create mode 100644 04_estructuras_de_iteracion/02_for/definicion.py create mode 100644 05_funciones/definicion.py create mode 100644 06_clases/definicion.py diff --git a/02_estructuras_de_datos/03_diccionarios/definicion.py b/02_estructuras_de_datos/03_diccionarios/definicion.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/02_estructuras_de_datos/03_diccionarios/definicion.py @@ -0,0 +1 @@ + diff --git a/02_estructuras_de_datos/03_diccionarios/metodos.py b/02_estructuras_de_datos/03_diccionarios/metodos.py new file mode 100644 index 0000000..e69de29 diff --git a/02_estructuras_de_datos/04_tuplas/definicion.py b/02_estructuras_de_datos/04_tuplas/definicion.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/02_estructuras_de_datos/04_tuplas/definicion.py @@ -0,0 +1 @@ + diff --git a/02_estructuras_de_datos/04_tuplas/metodos.py b/02_estructuras_de_datos/04_tuplas/metodos.py new file mode 100644 index 0000000..e69de29 diff --git a/03_sentencias_condicionales/definicion.py b/03_sentencias_condicionales/definicion.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/03_sentencias_condicionales/definicion.py @@ -0,0 +1 @@ + diff --git a/04_estructuras_de_iteracion/01_while/definicion.py b/04_estructuras_de_iteracion/01_while/definicion.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/04_estructuras_de_iteracion/01_while/definicion.py @@ -0,0 +1 @@ + diff --git a/04_estructuras_de_iteracion/02_for/definicion.py b/04_estructuras_de_iteracion/02_for/definicion.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/04_estructuras_de_iteracion/02_for/definicion.py @@ -0,0 +1 @@ + diff --git a/05_funciones/definicion.py b/05_funciones/definicion.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/05_funciones/definicion.py @@ -0,0 +1 @@ + diff --git a/06_clases/definicion.py b/06_clases/definicion.py new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/06_clases/definicion.py @@ -0,0 +1 @@ + From 27a9cb299b63897f57d1fee8e3468d8750a16fcf Mon Sep 17 00:00:00 2001 From: Tai543 Date: Fri, 30 Dec 2022 20:28:04 -0400 Subject: [PATCH 04/16] sets o conjuntos --- .../01_listas/definicion.py | 2 +- 02_estructuras_de_datos/01_listas/metodos.py | 1 - .../01_listas/mini-test.py | 7 ++++ .../02_conjuntos/definicion.py | 1 - .../02_conjuntos/metodos.py | 35 +++++++++---------- 5 files changed, 25 insertions(+), 21 deletions(-) create mode 100644 02_estructuras_de_datos/01_listas/mini-test.py diff --git a/02_estructuras_de_datos/01_listas/definicion.py b/02_estructuras_de_datos/01_listas/definicion.py index 8f2d80f..fce005d 100644 --- a/02_estructuras_de_datos/01_listas/definicion.py +++ b/02_estructuras_de_datos/01_listas/definicion.py @@ -6,7 +6,7 @@ likes = [] seguidores = list() # Con elementos -letras = list(["P", "Y", "T", "H", "O", "N", 3.9, 4]) +letras = list(["P", "Y", "T", "H", "O", "N", 3.9, True]) emociones = ["u_u", "uwu", "o_o", "uwu"] # Bonus: ✨ Veamos el tipo ✨ print(type(emociones)) diff --git a/02_estructuras_de_datos/01_listas/metodos.py b/02_estructuras_de_datos/01_listas/metodos.py index cde1b36..05b78c0 100644 --- a/02_estructuras_de_datos/01_listas/metodos.py +++ b/02_estructuras_de_datos/01_listas/metodos.py @@ -38,7 +38,6 @@ print(emociones) # R: ['e_e', 'owo', 'uwu'] - # ⭐️ Indice de un elemento ⭐️ # index(elemento) i = emociones.index("owo") diff --git a/02_estructuras_de_datos/01_listas/mini-test.py b/02_estructuras_de_datos/01_listas/mini-test.py new file mode 100644 index 0000000..e9e0d22 --- /dev/null +++ b/02_estructuras_de_datos/01_listas/mini-test.py @@ -0,0 +1,7 @@ +""" +@author taicoding +Tema: Listas +¿Cuál es el resultado? 👩🏻‍🏫👩🏻‍💻🐍 +""" +python = [1, 2, 3, 4, 5, 6] +print(python[2:5]) diff --git a/02_estructuras_de_datos/02_conjuntos/definicion.py b/02_estructuras_de_datos/02_conjuntos/definicion.py index 4207d78..4615331 100644 --- a/02_estructuras_de_datos/02_conjuntos/definicion.py +++ b/02_estructuras_de_datos/02_conjuntos/definicion.py @@ -11,4 +11,3 @@ # Bonus: ✨ Veamos el tipo ✨ print(type(numeros)) # R: -pares. \ No newline at end of file diff --git a/02_estructuras_de_datos/02_conjuntos/metodos.py b/02_estructuras_de_datos/02_conjuntos/metodos.py index 7f80a93..eadfa2c 100644 --- a/02_estructuras_de_datos/02_conjuntos/metodos.py +++ b/02_estructuras_de_datos/02_conjuntos/metodos.py @@ -1,22 +1,21 @@ """ @author taicoding -Metodos de Sets 🐍 +Métodos de Sets 🐍 """ -# Lista inicial -emociones = ["uwu"] +# Conjunto inicial +frutas = {"fresa", "sandia"} # ⭐️ Agregar un elemento ⭐️ -# append(elemento) -emociones.append("owo") -print(emociones) -# R: ['uwu', 'owo'] -# ⭐️ Agregar un elemento ⭐️ -# insert(indice,elemento) -emociones.insert(1, "e_e") -print(emociones) -# R: ['uwu', 'e_e', 'owo'] -# concatenacion de listas -emociones = emociones + ["o_o"] -print(emociones) -# R: ['uwu', 'e_e', 'owo', 'o_o'] -# ⭐️ Tip -# ⭐️ append es la forma mas rapida +# add(elemento) +frutas.add("uva") +print(frutas) +# R: {'sandia', 'fresa', 'uva'} +# ⭐️ Remover un elemento especifico ⭐️ +# discard(elemento) +frutas.discard("uva") +print(frutas) +# R: {'sandia', 'fresa'} +# ⭐️ Diferencia entre dos conjuntos ⭐️ +# set.difference(set) +bayas = {"fresa", "mora"} +print(bayas.difference(frutas)) +# R: {'mora'} From abd086215141c9fe8f6f6dc0d19cbefb3f21eb47 Mon Sep 17 00:00:00 2001 From: Tai543 Date: Fri, 30 Jun 2023 14:30:24 -0400 Subject: [PATCH 05/16] diccionarios --- .../02_conjuntos/definicion.py | 4 +- .../02_conjuntos/mini-test.py | 9 +++ .../03_diccionarios/definicion.py | 18 ++++- .../03_diccionarios/metodos.py | 70 +++++++++++++++++++ .../04_tuplas/mini-test.py | 8 +++ 5 files changed, 106 insertions(+), 3 deletions(-) create mode 100644 02_estructuras_de_datos/02_conjuntos/mini-test.py create mode 100644 02_estructuras_de_datos/04_tuplas/mini-test.py diff --git a/02_estructuras_de_datos/02_conjuntos/definicion.py b/02_estructuras_de_datos/02_conjuntos/definicion.py index 4615331..f626d13 100644 --- a/02_estructuras_de_datos/02_conjuntos/definicion.py +++ b/02_estructuras_de_datos/02_conjuntos/definicion.py @@ -9,5 +9,5 @@ frutas = set(["pera", "uva", "sandia"]) pares = {22, 44, 66, 88, 100} # Bonus: ✨ Veamos el tipo ✨ -print(type(numeros)) -# R: +print(type(verduras)) +# R: diff --git a/02_estructuras_de_datos/02_conjuntos/mini-test.py b/02_estructuras_de_datos/02_conjuntos/mini-test.py new file mode 100644 index 0000000..8205df9 --- /dev/null +++ b/02_estructuras_de_datos/02_conjuntos/mini-test.py @@ -0,0 +1,9 @@ +""" +@author taicoding +Tema: Sets +¿Cuál es el resultado? 👩🏻‍🏫👩🏻‍💻🐍 +""" +multiplos = {3, 6, 9, 12} +impares = {1, 3, 5, 7, 9} +print(multiplos & impares) +print(type(multiplos)) diff --git a/02_estructuras_de_datos/03_diccionarios/definicion.py b/02_estructuras_de_datos/03_diccionarios/definicion.py index 8b13789..bac5f7e 100644 --- a/02_estructuras_de_datos/03_diccionarios/definicion.py +++ b/02_estructuras_de_datos/03_diccionarios/definicion.py @@ -1 +1,17 @@ - +""" +@author taicoding +Formas de declarar un diccionario 🐍 +""" +# Sin elementos +recetas = {} +menu = dict() +# Con elementos +diccionario = dict({"llave": "valor"}) +cafeteria = { + "bebidas": ["café", "té", "jugo"], + "mesas": 5, +} +# Bonus: ✨ Veamos el tipo ✨ +print(type(menu)) +# R: +# Tip: La llave siempre es una cadena diff --git a/02_estructuras_de_datos/03_diccionarios/metodos.py b/02_estructuras_de_datos/03_diccionarios/metodos.py index e69de29..76ca495 100644 --- a/02_estructuras_de_datos/03_diccionarios/metodos.py +++ b/02_estructuras_de_datos/03_diccionarios/metodos.py @@ -0,0 +1,70 @@ +""" +@author taicoding +Métodos de Diccionarios 🐍 +""" +# Diccionario inicial +persona = dict({"nombre": "taicoding"}) +# ⭐️ Agregar elementos ⭐️ +persona.update({"edad": 27}) +print(persona) +# R: {'nombre': 'taicoding', +# 'edad': 27} +# ⭐️ Agregar elementos ⭐️ +persona["alergias"] = ["almendras"] +print(persona) +# R: {'nombre': 'taicoding', +# 'edad': 27, +# 'alergias': ['almendras']} + +# ⭐️ Remover un elemento especifico ⭐️ +persona.pop("alergias") +print(persona) +# R: {'nombre': 'taicoding', +# 'edad': 27} + +# ⭐️ Obtener el valor de una llave ⭐️ +edad = persona["edad"] +print(edad) +# R: 27 +edad = persona.get("edad") +print(edad) +# R: 27 + +# ⭐️ Obtener el valor de una llave ⭐️ +# Si la llave no existe regresa +# un valor por defecto +alergia = persona.setdefault("alergias", "ninguna") +print(alergia) +# R: ninguna +# ⭐️ Obtener una lista de las llaves ⭐️ +llaves = persona.keys() +print(llaves) +# R: dict_keys(['nombre', 'edad']) + +# ⭐️ Obtener una lista de los valores ⭐️ +valores = persona.values() +print(valores) +# R: dict_values(['taicoding', 27]) + +# ⭐️ Actualizar el valor de una llave ⭐️ +persona["edad"] = 29 +print(persona) +# R: {'nombre': 'taicoding', +# 'edad': 29} +persona.update({"edad": 30}) +print(persona) +# R: {'nombre': 'taicoding', +# 'edad': 30} + +# ⭐️ Eliminar todos los elementos ⭐️ +persona.clear() +print(persona) +# R: {} + +# ⭐️ Crear un diccionario desde una tupla +# de llaves y valores por defecto⭐️ +llaves = ("nombre", "edad") +valor = "vació" +persona = dict.fromkeys(llaves, valor) +print(persona) +# R: {'nombre': 'vació', 'edad': 'vació'} diff --git a/02_estructuras_de_datos/04_tuplas/mini-test.py b/02_estructuras_de_datos/04_tuplas/mini-test.py new file mode 100644 index 0000000..057a5ce --- /dev/null +++ b/02_estructuras_de_datos/04_tuplas/mini-test.py @@ -0,0 +1,8 @@ +""" +@author taicoding +Tema: Tuplas +¿Cuál es el resultado? 👩🏻‍🏫👩🏻‍💻🐍 +""" +pares = (2, 4, 6) +impares = (1, 3, 5) +print(pares > impares) From 0def45f488f688e7239f90ffae387f011f212dbb Mon Sep 17 00:00:00 2001 From: Tai543 Date: Tue, 26 Dec 2023 22:42:47 -0400 Subject: [PATCH 06/16] agregando la definicion de tuplas --- .../{01-enteros => 01_enteros}/definicion.py | 0 .../definicion.py | 0 .../operacionesSimples_I.py} | 0 .../operacionesSimples_II.py} | 0 .../operadores_III.py} | 0 .../02_numeros/{mini-test.py => mini_test.py} | 0 .../01_listas/{mini-test.py => mini_test.py} | 0 .../{mini-test.py => mini_test.py} | 0 .../04_tuplas/definicion.py | 15 +++++++++- 02_estructuras_de_datos/04_tuplas/metodos.py | 30 +++++++++++++++++++ .../04_tuplas/{mini-test.py => mini_test.py} | 0 solution.py | 2 ++ 12 files changed, 46 insertions(+), 1 deletion(-) rename 01_tipos_de_datos/02_numeros/{01-enteros => 01_enteros}/definicion.py (100%) rename 01_tipos_de_datos/02_numeros/{02-punto-flotante => 02_punto_flotante}/definicion.py (100%) rename 01_tipos_de_datos/02_numeros/{03-operaciones-numericas/OperacionesSimples_I.py => 03_operaciones_numericas/operacionesSimples_I.py} (100%) rename 01_tipos_de_datos/02_numeros/{03-operaciones-numericas/OperacionesSimples_II.py => 03_operaciones_numericas/operacionesSimples_II.py} (100%) rename 01_tipos_de_datos/02_numeros/{03-operaciones-numericas/Operadores_III.py => 03_operaciones_numericas/operadores_III.py} (100%) rename 01_tipos_de_datos/02_numeros/{mini-test.py => mini_test.py} (100%) rename 02_estructuras_de_datos/01_listas/{mini-test.py => mini_test.py} (100%) rename 02_estructuras_de_datos/02_conjuntos/{mini-test.py => mini_test.py} (100%) rename 02_estructuras_de_datos/04_tuplas/{mini-test.py => mini_test.py} (100%) create mode 100644 solution.py diff --git a/01_tipos_de_datos/02_numeros/01-enteros/definicion.py b/01_tipos_de_datos/02_numeros/01_enteros/definicion.py similarity index 100% rename from 01_tipos_de_datos/02_numeros/01-enteros/definicion.py rename to 01_tipos_de_datos/02_numeros/01_enteros/definicion.py diff --git a/01_tipos_de_datos/02_numeros/02-punto-flotante/definicion.py b/01_tipos_de_datos/02_numeros/02_punto_flotante/definicion.py similarity index 100% rename from 01_tipos_de_datos/02_numeros/02-punto-flotante/definicion.py rename to 01_tipos_de_datos/02_numeros/02_punto_flotante/definicion.py diff --git a/01_tipos_de_datos/02_numeros/03-operaciones-numericas/OperacionesSimples_I.py b/01_tipos_de_datos/02_numeros/03_operaciones_numericas/operacionesSimples_I.py similarity index 100% rename from 01_tipos_de_datos/02_numeros/03-operaciones-numericas/OperacionesSimples_I.py rename to 01_tipos_de_datos/02_numeros/03_operaciones_numericas/operacionesSimples_I.py diff --git a/01_tipos_de_datos/02_numeros/03-operaciones-numericas/OperacionesSimples_II.py b/01_tipos_de_datos/02_numeros/03_operaciones_numericas/operacionesSimples_II.py similarity index 100% rename from 01_tipos_de_datos/02_numeros/03-operaciones-numericas/OperacionesSimples_II.py rename to 01_tipos_de_datos/02_numeros/03_operaciones_numericas/operacionesSimples_II.py diff --git a/01_tipos_de_datos/02_numeros/03-operaciones-numericas/Operadores_III.py b/01_tipos_de_datos/02_numeros/03_operaciones_numericas/operadores_III.py similarity index 100% rename from 01_tipos_de_datos/02_numeros/03-operaciones-numericas/Operadores_III.py rename to 01_tipos_de_datos/02_numeros/03_operaciones_numericas/operadores_III.py diff --git a/01_tipos_de_datos/02_numeros/mini-test.py b/01_tipos_de_datos/02_numeros/mini_test.py similarity index 100% rename from 01_tipos_de_datos/02_numeros/mini-test.py rename to 01_tipos_de_datos/02_numeros/mini_test.py diff --git a/02_estructuras_de_datos/01_listas/mini-test.py b/02_estructuras_de_datos/01_listas/mini_test.py similarity index 100% rename from 02_estructuras_de_datos/01_listas/mini-test.py rename to 02_estructuras_de_datos/01_listas/mini_test.py diff --git a/02_estructuras_de_datos/02_conjuntos/mini-test.py b/02_estructuras_de_datos/02_conjuntos/mini_test.py similarity index 100% rename from 02_estructuras_de_datos/02_conjuntos/mini-test.py rename to 02_estructuras_de_datos/02_conjuntos/mini_test.py diff --git a/02_estructuras_de_datos/04_tuplas/definicion.py b/02_estructuras_de_datos/04_tuplas/definicion.py index 8b13789..fb73504 100644 --- a/02_estructuras_de_datos/04_tuplas/definicion.py +++ b/02_estructuras_de_datos/04_tuplas/definicion.py @@ -1 +1,14 @@ - +""" +@author taicoding +Formas de declarar una Tupla 🐍 +""" +# Sin elementos +coordenada = () +parametro = tuple() +# Con elementos +latitud = tuple((40.015, -3.1243)) +temperatura = (10, "Grados", "Celsius") +vectores = [3, 5, 7], [2, 4, 6] +# Bonus: ✨ Veamos el tipo ✨ +print(type(vectores)) +# R: diff --git a/02_estructuras_de_datos/04_tuplas/metodos.py b/02_estructuras_de_datos/04_tuplas/metodos.py index e69de29..15d8d10 100644 --- a/02_estructuras_de_datos/04_tuplas/metodos.py +++ b/02_estructuras_de_datos/04_tuplas/metodos.py @@ -0,0 +1,30 @@ +""" +@author taicoding +Métodos de Tuplas 🐍 +""" +# Tupla inicial +calificaciones = (2, 7, 8, 2, 5, 4, 2) +# ⭐️ Contar las apariciones de un elemento ⭐️ +# count(elemento) +contador = calificaciones.count(2) +print(contador) +# R: 3 +""" +@author taicoding +Métodos de Tuplas 🐍 +""" +# ⭐️ Obtener el indice de un elemento ⭐️ +# index(elemento) +indice = calificaciones.index(7) +print(indice) +# R: 1 +""" +@author taicoding +Métodos de Tuplas 🐍 +""" +# ⭐️ Obtener el indice de un elemento +# en un intervalo ⭐️ +# index(elemento, inicio, fin) +indice = calificaciones.index(2, 2, 5) +print(indice) +# R: 3 diff --git a/02_estructuras_de_datos/04_tuplas/mini-test.py b/02_estructuras_de_datos/04_tuplas/mini_test.py similarity index 100% rename from 02_estructuras_de_datos/04_tuplas/mini-test.py rename to 02_estructuras_de_datos/04_tuplas/mini_test.py diff --git a/solution.py b/solution.py new file mode 100644 index 0000000..b7b7963 --- /dev/null +++ b/solution.py @@ -0,0 +1,2 @@ +paises = [{"pais": "Bolivia", "capital": "Sucre"}, {"pais": "Peru", "capital": "Lima"}] +print(paises) From 72b68043f3a71fa7915ed1d557a69e43cb55b369 Mon Sep 17 00:00:00 2001 From: Tatiana Date: Tue, 26 Dec 2023 22:46:13 -0400 Subject: [PATCH 07/16] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index dd9ce12..928b02a 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ # PythonTips -Este repositorio pertenece a las imagenes publicadas en la cuenta de Instagram @t.ia543 +Este repositorio pertenece a las imagenes publicadas en la cuenta de Instagram [@taicoding](https://www.instagram.com/taicoding/) From 1f96af07c9b28744462363381ebeaf61b1f17281 Mon Sep 17 00:00:00 2001 From: Tai543 Date: Sun, 21 Apr 2024 23:10:37 -0400 Subject: [PATCH 08/16] update readme --- README.md | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index dd9ce12..97a48ca 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,29 @@ -# PythonTips -Este repositorio pertenece a las imagenes publicadas en la cuenta de Instagram @t.ia543 +# Python Tips by Taicoding + +### ¿Te cuesta entender código en Python? +En este repositorio encontrarás una serie de tips y ejemplos de fragmentos de código en Python comentados linea por linea para que puedas aprender de manera sencilla y rápida. + +### ¿Como usar este repositorio? +1. Clona este repositorio en tu máquina local. +2. Abre el archivo README.md y selecciona el tema que desees aprender. +3. Dentro de los archivos `definicion.py` encontraras la definición correspondiente al tema seleccionado. +4. Dentro de los archivos `mini_test.py` encontraras preguntas y ejemplos de código para que puedas practicar. + +### Temas disponibles +1. [Tipos de datos](/01_tipos_de_datos/) + 1. [Booleanos](/01_tipos_de_datos/01_booleanos/) + 2. [Números](/01_tipos_de_datos/02_numeros/) + 3. [Cadenas](/01_tipos_de_datos/03_cadenas/) +2. [Estructuras de Datos](/02_estructuras_de_datos/) + 1. [Listas](/02_estructuras_de_datos/01_listas/) + 2. [Conjuntos](/02_estructuras_de_datos/02_conjuntos/) + 3. [Diccionarios](/02_estructuras_de_datos/03_diccionarios/) + 4. [Tuplas](/02_estructuras_de_datos/04_tuplas/) +3. [Sentencias Condicionales](/03_sentencias_condicionales/) +4. [Bucles](/04_estructuras_de_iteracion/) + 1. [While](/04_estructuras_de_iteracion/01_while/) + 2. [For](/04_estructuras_de_iteracion/02_for/) +5. [Funciones](/05_funciones/) + +### Instagram +Encuentra todo el contenido de este repositorio en mi cuenta de Instagram [@taicoding](https://www.instagram.com/taicoding/) \ No newline at end of file From 7d141bbf3e7370f305ca4e8150f79ec3dd3c0d2e Mon Sep 17 00:00:00 2001 From: Tai543 Date: Sun, 21 Apr 2024 23:19:51 -0400 Subject: [PATCH 09/16] fixing readme --- README.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/README.md b/README.md index eaf2fb4..fb50900 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # Python Tips by Taicoding +Encuentra todo el contenido de este repositorio en mi cuenta de Instagram [@taicoding](https://www.instagram.com/taicoding/) ### ¿Te cuesta entender código en Python? En este repositorio encontrarás una serie de tips y ejemplos de fragmentos de código en Python comentados linea por linea para que puedas aprender de manera sencilla y rápida. @@ -25,6 +26,3 @@ En este repositorio encontrarás una serie de tips y ejemplos de fragmentos de c 2. [For](/04_estructuras_de_iteracion/02_for/) 5. [Funciones](/05_funciones/) -### Instagram -Encuentra todo el contenido de este repositorio en mi cuenta de Instagram [@taicoding](https://www.instagram.com/taicoding/) - From 8db557534e4be107bf6e133e0b1fffc7634ebad1 Mon Sep 17 00:00:00 2001 From: Tatiana Date: Mon, 6 May 2024 14:42:41 -0400 Subject: [PATCH 10/16] Create LICENSE --- LICENSE | 201 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 201 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. From a94d204863d4333ecfbaf05e613db059ae5253cd Mon Sep 17 00:00:00 2001 From: Tai543 Date: Thu, 22 Aug 2024 22:41:09 -0400 Subject: [PATCH 11/16] Renew tuplas --- .../01_listas/mini_test.py | 8 +++- 02_estructuras_de_datos/04_tuplas/metodos.py | 37 ++++++++++--------- 2 files changed, 25 insertions(+), 20 deletions(-) diff --git a/02_estructuras_de_datos/01_listas/mini_test.py b/02_estructuras_de_datos/01_listas/mini_test.py index e9e0d22..e37bd3b 100644 --- a/02_estructuras_de_datos/01_listas/mini_test.py +++ b/02_estructuras_de_datos/01_listas/mini_test.py @@ -1,7 +1,11 @@ """ -@author taicoding -Tema: Listas +Reto semanal - I ¿Cuál es el resultado? 👩🏻‍🏫👩🏻‍💻🐍 """ + python = [1, 2, 3, 4, 5, 6] print(python[2:5]) +""" +👍 [2, 5] ❤️ [3, 4, 5] +😮 [2, 3, 4] 🙏 [4, 5, 6] +""" diff --git a/02_estructuras_de_datos/04_tuplas/metodos.py b/02_estructuras_de_datos/04_tuplas/metodos.py index 15d8d10..be99c65 100644 --- a/02_estructuras_de_datos/04_tuplas/metodos.py +++ b/02_estructuras_de_datos/04_tuplas/metodos.py @@ -1,30 +1,31 @@ """ @author taicoding -Métodos de Tuplas 🐍 +Métodos de Tuplas 🐍🧮 """ -# Tupla inicial -calificaciones = (2, 7, 8, 2, 5, 4, 2) -# ⭐️ Contar las apariciones de un elemento ⭐️ -# count(elemento) -contador = calificaciones.count(2) + +# Definimos una tupla de calificaciones +calificaciones = (51, 70, 80, 51, 65) +# 🔢 Contar las apariciones de un elemento +# Método: count(elemento) +contador = calificaciones.count(51) print(contador) -# R: 3 +# 🖨️ Resultado: 2 """ @author taicoding -Métodos de Tuplas 🐍 +Métodos de Tuplas 🐍🧮 """ -# ⭐️ Obtener el indice de un elemento ⭐️ -# index(elemento) -indice = calificaciones.index(7) +# 🔍 Obtener el indice de un elemento +# Método: index(elemento) +indice = calificaciones.index(70) print(indice) -# R: 1 +# 🖨️ Resultado: 1 """ @author taicoding -Métodos de Tuplas 🐍 +Métodos de Tuplas 🐍🧮 """ -# ⭐️ Obtener el indice de un elemento -# en un intervalo ⭐️ -# index(elemento, inicio, fin) -indice = calificaciones.index(2, 2, 5) +# 📍 Obtener el indice de un elemento +# en un intervalo específico 🔛 +# Método: index(elemento, inicio, fin) +indice = calificaciones.index(51, 2, 5) print(indice) -# R: 3 +# 🖨️ Resultado: 3 From 31fb4675a331b4e53fc1cd2514b19b62bd74c907 Mon Sep 17 00:00:00 2001 From: Tai543 Date: Mon, 26 Aug 2024 15:48:59 -0400 Subject: [PATCH 12/16] Update Mini Test --- 02_estructuras_de_datos/01_listas/mini_test.py | 7 ++----- 02_estructuras_de_datos/04_tuplas/mini_test.py | 9 +++++---- 2 files changed, 7 insertions(+), 9 deletions(-) diff --git a/02_estructuras_de_datos/01_listas/mini_test.py b/02_estructuras_de_datos/01_listas/mini_test.py index e37bd3b..e3c491e 100644 --- a/02_estructuras_de_datos/01_listas/mini_test.py +++ b/02_estructuras_de_datos/01_listas/mini_test.py @@ -1,11 +1,8 @@ """ -Reto semanal - I +@author taicoding +Tema: Listas 📋 ¿Cuál es el resultado? 👩🏻‍🏫👩🏻‍💻🐍 """ python = [1, 2, 3, 4, 5, 6] print(python[2:5]) -""" -👍 [2, 5] ❤️ [3, 4, 5] -😮 [2, 3, 4] 🙏 [4, 5, 6] -""" diff --git a/02_estructuras_de_datos/04_tuplas/mini_test.py b/02_estructuras_de_datos/04_tuplas/mini_test.py index 057a5ce..c32fa2e 100644 --- a/02_estructuras_de_datos/04_tuplas/mini_test.py +++ b/02_estructuras_de_datos/04_tuplas/mini_test.py @@ -1,8 +1,9 @@ """ @author taicoding -Tema: Tuplas +Tema: Tuplas 🐍🧮 ¿Cuál es el resultado? 👩🏻‍🏫👩🏻‍💻🐍 """ -pares = (2, 4, 6) -impares = (1, 3, 5) -print(pares > impares) + +menu = ("🧁", "🍪", "🍟", "🍕", "🍨") +helado = menu.index("🍨") +print(helado) From a154b9ed8cbc48539487b66ac8af9097069035de Mon Sep 17 00:00:00 2001 From: Tai543 Date: Mon, 26 Aug 2024 15:51:20 -0400 Subject: [PATCH 13/16] fixing format --- 02_estructuras_de_datos/03_diccionarios/metodos.py | 1 + 02_estructuras_de_datos/04_tuplas/metodos.py | 10 ++-------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/02_estructuras_de_datos/03_diccionarios/metodos.py b/02_estructuras_de_datos/03_diccionarios/metodos.py index 76ca495..9e0f0eb 100644 --- a/02_estructuras_de_datos/03_diccionarios/metodos.py +++ b/02_estructuras_de_datos/03_diccionarios/metodos.py @@ -2,6 +2,7 @@ @author taicoding Métodos de Diccionarios 🐍 """ + # Diccionario inicial persona = dict({"nombre": "taicoding"}) # ⭐️ Agregar elementos ⭐️ diff --git a/02_estructuras_de_datos/04_tuplas/metodos.py b/02_estructuras_de_datos/04_tuplas/metodos.py index be99c65..fa08d70 100644 --- a/02_estructuras_de_datos/04_tuplas/metodos.py +++ b/02_estructuras_de_datos/04_tuplas/metodos.py @@ -10,19 +10,13 @@ contador = calificaciones.count(51) print(contador) # 🖨️ Resultado: 2 -""" -@author taicoding -Métodos de Tuplas 🐍🧮 -""" + # 🔍 Obtener el indice de un elemento # Método: index(elemento) indice = calificaciones.index(70) print(indice) # 🖨️ Resultado: 1 -""" -@author taicoding -Métodos de Tuplas 🐍🧮 -""" + # 📍 Obtener el indice de un elemento # en un intervalo específico 🔛 # Método: index(elemento, inicio, fin) From 60050b7127b92f475632bb87d3c524bd5c565091 Mon Sep 17 00:00:00 2001 From: Tai543 Date: Thu, 29 Aug 2024 15:38:56 -0400 Subject: [PATCH 14/16] update list methods --- 02_estructuras_de_datos/01_listas/metodos.py | 73 +++++++++++--------- 1 file changed, 40 insertions(+), 33 deletions(-) diff --git a/02_estructuras_de_datos/01_listas/metodos.py b/02_estructuras_de_datos/01_listas/metodos.py index 05b78c0..f023475 100644 --- a/02_estructuras_de_datos/01_listas/metodos.py +++ b/02_estructuras_de_datos/01_listas/metodos.py @@ -1,45 +1,52 @@ """ @author taicoding -Métodos de Listas 🐍 +Métodos para agregar elementos a una Lista 🐍📜 """ -# Lista inicial -emociones = ["uwu"] -# ⭐️ Agregar un elemento ⭐️ -# append(elemento) -emociones.append("owo") -print(emociones) -# R: ['uwu', 'owo'] -# ⭐️ Tip: append es la forma mas rápida -# ⭐️ Agregar un elemento ⭐️ -# insert(indice,elemento) -emociones.insert(1, "e_e") +# Declaramos una lista de emociones +emociones = ["😊"] +# 📂 Agregar una nueva emoción al final de la lista +# Método: append(elemento) +emociones.append("😢") print(emociones) -# R: ['uwu', 'e_e', 'owo'] - -# concatenación de listas -emociones = emociones + ["o_o"] +# 🖨️ Resultado: ['😊', '😢'] +# 📂 Agregar una nueva emoción en una posición +# especifica de la lista +# Método: insert(posición,elemento) +emociones.insert(1, "😵") print(emociones) -# R: ['uwu', 'e_e', 'owo', 'o_o'] - -# ⭐️ Remueve un elemento ⭐️ -# remove(elemento) -emociones.remove("o_o") +# 🖨️ Resultado: ['😊', '😵', '😢'] +# 🧩 Agregar emociones utilizando otro iterable +# Un iterable puede ser una lista, tupla, cadena, etc. +# Método: extend(lista) +emociones.extend({"😄", "😍"}) +print(emociones) +# 🖨️ Resultado: ['😊', '😵', '😢', '😍', '😄'] +# 🧩 Agregar una emoción concatenando dos listas +emociones = emociones + ["😢"] print(emociones) -# R: ['uwu', 'e_e', 'owo'] +# 🖨️ Resultado: ['😊', '😵', '😢', '😍', '😄', '😢'] +# ⭐️ Tip: El método append es el mas rápido -# ⭐️ Revertir la Lista ⭐️ +# Declaramos una lista de emociones +emociones = ["😊", "😵", "😍", "😄", "😢"] +# 🗑️ Remover un elemento de la Lista +# Método: remove(elemento) +emociones.remove("😢") +print(emociones) +# 🖨️ Resultado: ['😊', '😵', '😍', '😄'] +# 🔄 Revertir los elementos de la Lista +# Método: reverse() emociones.reverse() print(emociones) -# R: ['owo', 'e_e', 'uwu'] - -# ⭐️ Ordenar la Lista ⭐️ +# 🖨️ Resultado: ['😄', '😍', '😵', '😊'] +# 📊 Ordenar los elementos de la Lista +# Método: sort() emociones.sort() print(emociones) -# R: ['e_e', 'owo', 'uwu'] - -# ⭐️ Indice de un elemento ⭐️ -# index(elemento) -i = emociones.index("owo") -print(i) -# R: 1 +# 🖨️ Resultado: ['😄', '😊', '😍', '😵'] +# 🔍 Obtener el indice de un elemento +# Método: index(elemento) +indice = emociones.index("😍") +print(indice) +# 🖨️ Resultado: 2 From 648fbacc287c8f8b52e030ac39493cf2380b7407 Mon Sep 17 00:00:00 2001 From: Tai543 Date: Tue, 3 Sep 2024 14:53:46 -0400 Subject: [PATCH 15/16] sets y listas --- .../01_listas/definicion.py | 3 +- .../02_conjuntos/metodos.py | 36 +++++++++++-------- 2 files changed, 23 insertions(+), 16 deletions(-) diff --git a/02_estructuras_de_datos/01_listas/definicion.py b/02_estructuras_de_datos/01_listas/definicion.py index fce005d..88fad09 100644 --- a/02_estructuras_de_datos/01_listas/definicion.py +++ b/02_estructuras_de_datos/01_listas/definicion.py @@ -2,12 +2,13 @@ @author taicoding Formas de declarar una lista """ + # Sin elementos likes = [] seguidores = list() # Con elementos letras = list(["P", "Y", "T", "H", "O", "N", 3.9, True]) -emociones = ["u_u", "uwu", "o_o", "uwu"] +emociones = ["😌", "😖", "🤩", "😐"] # Bonus: ✨ Veamos el tipo ✨ print(type(emociones)) # R: diff --git a/02_estructuras_de_datos/02_conjuntos/metodos.py b/02_estructuras_de_datos/02_conjuntos/metodos.py index eadfa2c..32f372e 100644 --- a/02_estructuras_de_datos/02_conjuntos/metodos.py +++ b/02_estructuras_de_datos/02_conjuntos/metodos.py @@ -1,21 +1,27 @@ """ @author taicoding -Métodos de Sets 🐍 +Métodos de Conjuntos 🐍🍟 """ -# Conjunto inicial -frutas = {"fresa", "sandia"} -# ⭐️ Agregar un elemento ⭐️ -# add(elemento) -frutas.add("uva") + +# Definimos un conjunto de frutas +frutas = {"🍓", "🍉"} +# 🧩 Agregar un elemento al conjunto +# Método: add(elemento) +frutas.add("🍋") print(frutas) -# R: {'sandia', 'fresa', 'uva'} -# ⭐️ Remover un elemento especifico ⭐️ -# discard(elemento) -frutas.discard("uva") +# 🖨️ Resultado: {'🍋', '🍓', '🍉'} +# 🗑️ Remover un elemento al conjunto +# Método: discard(elemento) +frutas.discard("🍋") print(frutas) -# R: {'sandia', 'fresa'} -# ⭐️ Diferencia entre dos conjuntos ⭐️ -# set.difference(set) -bayas = {"fresa", "mora"} +# 🖨️ Resultado: {'🍓', '🍉'} +# 🔗 Encontrar la diferencia entre dos conjuntos +# Método: difference(set) +bayas = {"🍓", "🍒"} print(bayas.difference(frutas)) -# R: {'mora'} +# 🖨️ Resultado: {"🍒"} +# 🔘 Unir dos conjuntos +# Método: union(set) +frutas = frutas.union(bayas) +print(frutas) +# 🖨️ Resultado: {'🍒', '🍓', '🍉'} From 8a19636be1c144ed42e4665c4312033cd75b9872 Mon Sep 17 00:00:00 2001 From: Tai543 Date: Mon, 9 Sep 2024 21:50:24 -0400 Subject: [PATCH 16/16] updated mini test sets --- 02_estructuras_de_datos/02_conjuntos/mini_test.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/02_estructuras_de_datos/02_conjuntos/mini_test.py b/02_estructuras_de_datos/02_conjuntos/mini_test.py index 8205df9..02e079a 100644 --- a/02_estructuras_de_datos/02_conjuntos/mini_test.py +++ b/02_estructuras_de_datos/02_conjuntos/mini_test.py @@ -1,9 +1,10 @@ """ @author taicoding -Tema: Sets +Tema: Sets 🐍🍟 ¿Cuál es el resultado? 👩🏻‍🏫👩🏻‍💻🐍 """ + multiplos = {3, 6, 9, 12} impares = {1, 3, 5, 7, 9} -print(multiplos & impares) -print(type(multiplos)) +resultado = multiplos.intersection(impares) +print(resultado)