clase 2
This commit is contained in:
parent
6eeca5d9c5
commit
95daf5d965
BIN
clase_1/ejercicios.pdf
Normal file
BIN
clase_1/ejercicios.pdf
Normal file
Binary file not shown.
14
clase_1/ejercicios/1_calculadora.py
Normal file
14
clase_1/ejercicios/1_calculadora.py
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
numero1 = int(input("Ingrese el primer número: "))
|
||||
numero2 = int(input("Ingrese el segundo número: "))
|
||||
|
||||
# Operaciones
|
||||
suma = numero1 + numero2
|
||||
resta = numero1 - numero2
|
||||
multiplicacion = numero1 * numero2
|
||||
division = numero1 / numero2
|
||||
|
||||
# Mostrar resultados
|
||||
print("Suma:", suma)
|
||||
print("Resta:", resta)
|
||||
print("Multiplicación:", multiplicacion)
|
||||
print("División:", division)
|
||||
11
clase_1/ejercicios/2_cuadrados
Normal file
11
clase_1/ejercicios/2_cuadrados
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
cuadrado_for=0
|
||||
cuadrado_while=0
|
||||
|
||||
for cuadrado_for in range(0,11):
|
||||
print("el cuadrado con for de ", cuadrado_for, " Es: ", cuadrado_for * cuadrado_for)
|
||||
print(f"el cuadrado con for de {cuadrado_for} Es: {cuadrado_for * cuadrado_for}")
|
||||
print("----------------------------------")
|
||||
|
||||
while cuadrado_while < 11:
|
||||
print("el cuadrado con while de ", cuadrado_while, " Es: ", cuadrado_while * cuadrado_while)
|
||||
cuadrado_while +=1
|
||||
8
clase_1/ejercicios/3_pares.py
Normal file
8
clase_1/ejercicios/3_pares.py
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
contador=0
|
||||
for contador in range(0,121):
|
||||
if (contador % 2) == 0 :
|
||||
contador = 0
|
||||
for contador in range(0, 121):
|
||||
if (contador % 2) == 0:
|
||||
print("El numero :", contador, "Es Par")
|
||||
|
||||
13
clase_1/ejercicios/4_mostrar_numeros_entre_dos.py
Normal file
13
clase_1/ejercicios/4_mostrar_numeros_entre_dos.py
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# Pedir números al usuario
|
||||
numero1 = int(input("Ingrese el primer número: "))
|
||||
numero2 = int(input("Ingrese el segundo número: "))
|
||||
|
||||
# Verificar condición
|
||||
if numero1 < numero2:
|
||||
|
||||
# Mostrar números entre ellos
|
||||
for i in range(numero1, numero2 + 1):
|
||||
print(i)
|
||||
|
||||
else:
|
||||
print("El primer número debe ser menor que el segundo")
|
||||
12
clase_1/ejercicios/5_tablas.py
Normal file
12
clase_1/ejercicios/5_tablas.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
|
||||
for tabla in range(1, 11):
|
||||
|
||||
print("======================")
|
||||
print("TABLA DEL", tabla)
|
||||
print("======================")
|
||||
|
||||
for numero in range(1, 13):
|
||||
resultado = tabla * numero
|
||||
print(tabla, "x", numero, "=", resultado)
|
||||
|
||||
print()
|
||||
18
clase_1/ejercicios/6_impares.py
Normal file
18
clase_1/ejercicios/6_impares.py
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
# Pedir números
|
||||
numero1 = int(input("Ingrese el primer número: "))
|
||||
numero2 = int(input("Ingrese el segundo número: "))
|
||||
|
||||
# Validar orden
|
||||
if numero1 < numero2:
|
||||
|
||||
print(f"Números impares entre: {numero1} y {numero2}")
|
||||
|
||||
# Recorrer el rango
|
||||
for i in range(numero1, numero2 + 1):
|
||||
|
||||
# Verificar si es impar
|
||||
if i % 2 != 0:
|
||||
print(i)
|
||||
|
||||
else:
|
||||
print("El primer número debe ser menor que el segundo")
|
||||
8
clase_1/ejercicios/7_porcentaje.py
Normal file
8
clase_1/ejercicios/7_porcentaje.py
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
numero = float(input("Ingrese un número: "))
|
||||
porcentaje = float(input("Ingrese el porcentaje: "))
|
||||
|
||||
# Calcular porcentaje
|
||||
resultado = (numero * porcentaje) / 100
|
||||
|
||||
# Mostrar resultado
|
||||
print("El", porcentaje, "% de", numero, "es:", resultado)
|
||||
21
clase_1/ejercicios/8_bucle_indefinido.py
Normal file
21
clase_1/ejercicios/8_bucle_indefinido.py
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
# Contador
|
||||
contador = 0
|
||||
|
||||
# Bucle infinito
|
||||
while True:
|
||||
|
||||
numero = int(input("Ingrese un número (111 para salir): "))
|
||||
|
||||
# Verificar si desea salir
|
||||
if numero == 111:
|
||||
print("Programa finalizado")
|
||||
break
|
||||
|
||||
# Mostrar número ingresado
|
||||
print("Ingresaste:", numero)
|
||||
|
||||
# Aumentar contador
|
||||
contador += 1
|
||||
|
||||
# Mostrar cantidad de números ingresados
|
||||
print("Cantidad de números ingresados:", contador)
|
||||
5
clase_1/ejercicios/9_float.py
Normal file
5
clase_1/ejercicios/9_float.py
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
numero= int(input("ingrese un numero"))
|
||||
|
||||
print(f"el numero ingresado es {float(numero):.3f}")
|
||||
|
||||
print(type(float(numero)))
|
||||
BIN
clase_1/hoja de ruta.png
Normal file
BIN
clase_1/hoja de ruta.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.5 MiB |
BIN
clase_1/python.png
Normal file
BIN
clase_1/python.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.4 MiB |
25
clase_2/10_predefinidas.py
Normal file
25
clase_2/10_predefinidas.py
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
nombre= " Cristian Moreno "
|
||||
|
||||
print(nombre) #print
|
||||
print(type(nombre)) #type tipo de datos
|
||||
|
||||
if isinstance (nombre, str) : #isinstance saber si es un tipo de datos
|
||||
print ("es un string")
|
||||
|
||||
print(nombre.strip()) #stripe elimina espacios en blancos a los lados
|
||||
|
||||
print(len(nombre)) #len cantidad de caracteres
|
||||
|
||||
print(nombre.find("Cristian")) # find busca una cadena o un caracter
|
||||
|
||||
print(nombre.replace("Cristian", "Gerardo")) #replace reemplaza una palabra por otra
|
||||
|
||||
print(nombre.lower()) #convierte a minusculas
|
||||
print(nombre.upper()) #convierte a
|
||||
|
||||
del nombre # del elimina variable
|
||||
|
||||
print(nombre)
|
||||
|
||||
|
||||
|
||||
11
clase_2/1_match.py
Normal file
11
clase_2/1_match.py
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
dia = int(input("Ingrese un número del 1 al 3: "))
|
||||
|
||||
match dia:
|
||||
case 1:
|
||||
print("Lunes")
|
||||
case 2:
|
||||
print("Martes")
|
||||
case 3:
|
||||
print("Miércoles")
|
||||
case _:
|
||||
print("Día inválido")
|
||||
17
clase_2/2_funciones.py
Normal file
17
clase_2/2_funciones.py
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
#definir función
|
||||
def mostrarNombres(persona, edad):
|
||||
print(f"el nombre de la persona es: {persona}")
|
||||
if edad >= 18:
|
||||
print("es mayor a 18 años \n")
|
||||
else:
|
||||
print("es menor de edad\n")
|
||||
|
||||
#llamar función
|
||||
mostrarNombres("Cristian Moreno", 10)
|
||||
mostrarNombres("Bruno Diaz",20)
|
||||
mostrarNombres("Exequiel Saavedra", 18)
|
||||
|
||||
nom = input("introduce tu nombre: ")
|
||||
edad= int(input ("introduce tu edad"))
|
||||
#llamar funcon con parámtro dinámico
|
||||
mostrarNombres(nom, edad)
|
||||
10
clase_2/3_ejercicio_de_funciones.py
Normal file
10
clase_2/3_ejercicio_de_funciones.py
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
def tabla (numero):
|
||||
print(f"tabla de multiplicar del : {numero}")
|
||||
for contador in range(1,13):
|
||||
operacion = numero * contador
|
||||
print(f"{numero} x {contador} = {operacion}")
|
||||
|
||||
|
||||
tabla(3)
|
||||
tabla(5)
|
||||
tabla(10)
|
||||
9
clase_2/4_parámetros_opcionales.py
Normal file
9
clase_2/4_parámetros_opcionales.py
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
def empleados (nombre, dni= None): #tambien puede ser False
|
||||
print("Empleado")
|
||||
print(f"nombre: {nombre}")
|
||||
|
||||
|
||||
print(f"dni: {dni}")
|
||||
|
||||
empleados("Cristian Moreno", "36039548")
|
||||
empleados("Esteban Ibañez")
|
||||
5
clase_2/5_return.py
Normal file
5
clase_2/5_return.py
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
def saludame(nombre):
|
||||
saludo= f"Hola {nombre} , cómo estás?"
|
||||
return saludo
|
||||
|
||||
print(saludame("Cristian Moreno"))
|
||||
26
clase_2/6_mas_retur.py
Normal file
26
clase_2/6_mas_retur.py
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
def operaciones (numero1, numero2, basicas = False):
|
||||
suma= numero1 + numero2
|
||||
resta= numero1 - numero2
|
||||
multiplicacion= numero1 * numero2
|
||||
division= numero1 / numero2
|
||||
|
||||
cadena= ""
|
||||
if basicas == True :
|
||||
cadena += "Suma :" + str(suma)
|
||||
cadena += "\n"
|
||||
cadena += "Resta :" + str(resta)
|
||||
cadena += "\n"
|
||||
else:
|
||||
cadena += "Suma :" + str(suma)
|
||||
cadena += "\n"
|
||||
cadena += "Resta :" + str(resta)
|
||||
cadena += "\n"
|
||||
cadena += "Multiplicación :"+ str(multiplicacion)
|
||||
cadena += "\n"
|
||||
cadena += "Division :" + str(division)
|
||||
cadena += "\n"
|
||||
|
||||
return cadena
|
||||
|
||||
print(operaciones(10,2, True))
|
||||
|
||||
12
clase_2/7_funciones_dentro_de_otras.py
Normal file
12
clase_2/7_funciones_dentro_de_otras.py
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
def devuelveTodo(nombre, apellidos):
|
||||
|
||||
def getNombre():
|
||||
return f"el nombre es : {nombre}"
|
||||
|
||||
def getApellidos():
|
||||
return f"el apellido es : {apellidos}"
|
||||
|
||||
return getNombre() + "\n" + getApellidos()
|
||||
|
||||
print(devuelveTodo("Cristian", "Moreno"))
|
||||
|
||||
23
clase_2/8_funciones_lambda.py
Normal file
23
clase_2/8_funciones_lambda.py
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
sumar = lambda a, b: a + b
|
||||
|
||||
print(sumar(5, 3))
|
||||
|
||||
###########################
|
||||
cuadrado = lambda numero: numero * numero
|
||||
|
||||
print(cuadrado(4))
|
||||
|
||||
###########################
|
||||
calcularIVA = lambda precio: precio * 0.21
|
||||
|
||||
print(calcularIVA(1000))
|
||||
|
||||
contador=0
|
||||
print(f"el contador es: {contador}")
|
||||
|
||||
def verContador ():
|
||||
contador= 1
|
||||
print(f"el contador dentro de la f es : {contador}")
|
||||
|
||||
verContador()
|
||||
print(f"el contador es: {contador}")
|
||||
11
clase_2/9_variablesGlobalesLocales.py
Normal file
11
clase_2/9_variablesGlobalesLocales.py
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
contador = 0
|
||||
print(f"el contador es: {contador}")
|
||||
|
||||
def verContador():
|
||||
contador=0
|
||||
contador += 1
|
||||
print(f"el contador dentro de la f es : {contador}")
|
||||
|
||||
verContador()
|
||||
|
||||
print(f"el contador es: {contador}")
|
||||
99
clase_2/Apunte_Funciones_Expresiones_Python.pdf
Normal file
99
clase_2/Apunte_Funciones_Expresiones_Python.pdf
Normal file
|
|
@ -0,0 +1,99 @@
|
|||
%PDF-1.4
|
||||
%“Œ‹ž ReportLab Generated PDF document http://www.reportlab.com
|
||||
1 0 obj
|
||||
<<
|
||||
/F1 2 0 R /F2 3 0 R /F3 4 0 R
|
||||
>>
|
||||
endobj
|
||||
2 0 obj
|
||||
<<
|
||||
/BaseFont /Helvetica /Encoding /WinAnsiEncoding /Name /F1 /Subtype /Type1 /Type /Font
|
||||
>>
|
||||
endobj
|
||||
3 0 obj
|
||||
<<
|
||||
/BaseFont /Helvetica-Bold /Encoding /WinAnsiEncoding /Name /F2 /Subtype /Type1 /Type /Font
|
||||
>>
|
||||
endobj
|
||||
4 0 obj
|
||||
<<
|
||||
/BaseFont /Symbol /Name /F3 /Subtype /Type1 /Type /Font
|
||||
>>
|
||||
endobj
|
||||
5 0 obj
|
||||
<<
|
||||
/Contents 10 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 9 0 R /Resources <<
|
||||
/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ]
|
||||
>> /Rotate 0 /Trans <<
|
||||
|
||||
>>
|
||||
/Type /Page
|
||||
>>
|
||||
endobj
|
||||
6 0 obj
|
||||
<<
|
||||
/Contents 11 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 9 0 R /Resources <<
|
||||
/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ]
|
||||
>> /Rotate 0 /Trans <<
|
||||
|
||||
>>
|
||||
/Type /Page
|
||||
>>
|
||||
endobj
|
||||
7 0 obj
|
||||
<<
|
||||
/PageMode /UseNone /Pages 9 0 R /Type /Catalog
|
||||
>>
|
||||
endobj
|
||||
8 0 obj
|
||||
<<
|
||||
/Author (\(anonymous\)) /CreationDate (D:20260603153946+00'00') /Creator (\(unspecified\)) /Keywords () /ModDate (D:20260603153946+00'00') /Producer (ReportLab PDF Library - www.reportlab.com)
|
||||
/Subject (\(unspecified\)) /Title (\(anonymous\)) /Trapped /False
|
||||
>>
|
||||
endobj
|
||||
9 0 obj
|
||||
<<
|
||||
/Count 2 /Kids [ 5 0 R 6 0 R ] /Type /Pages
|
||||
>>
|
||||
endobj
|
||||
10 0 obj
|
||||
<<
|
||||
/Filter [ /ASCII85Decode /FlateDecode ] /Length 1316
|
||||
>>
|
||||
stream
|
||||
Gau0C>Ar7S'RnB3364a`/lP4(?D&7G+[HL3^q+6,nd?bkR0&4e8BGO+m(`9kZ4olqjeU10^bKcb\aV[&:C,VJ+jG47!rNtSRqi(Y6G*?Y=t[`PE###$T99)t+G>85<Z":LT"kLcD0`9sj+P!,6Nkhi;BOm2&Ligg+AutD#dN^r-Z"Sp=C'N&c)'@p'!=E:("^\1*hZkj)ce:'""l2K^4Z2<O<CoHhqKCRr_WP<qm@M;(g4fIp\<tM-iAo*YXoqPAB>A'-oT8*..I@DT#TpdTt*n'65/(1=KnYgn>T_U*WboH((<)JP-s=3ioeV13OaC&9_/%^<O+QAG@WXERuFNL)HgeA6;ko%RR>(<2:G]W.m`^:b)?0*9*u/@<H2W*NLps'&K]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
|
||||
0000000124 00000 n
|
||||
0000000231 00000 n
|
||||
0000000343 00000 n
|
||||
0000000420 00000 n
|
||||
0000000624 00000 n
|
||||
0000000828 00000 n
|
||||
0000000896 00000 n
|
||||
0000001179 00000 n
|
||||
0000001244 00000 n
|
||||
0000002652 00000 n
|
||||
trailer
|
||||
<<
|
||||
/ID
|
||||
[<110018827922e6e570ea04fea4ed9b7b><110018827922e6e570ea04fea4ed9b7b>]
|
||||
% ReportLab generated PDF document -- digest (http://www.reportlab.com)
|
||||
|
||||
/Info 8 0 R
|
||||
/Root 7 0 R
|
||||
/Size 12
|
||||
>>
|
||||
startxref
|
||||
3730
|
||||
%%EOF
|
||||
0
clase_2/ejercicios/ejercicios.docx
Normal file
0
clase_2/ejercicios/ejercicios.docx
Normal file
BIN
clase_2/ejercicios/~$ercicios.docx
Normal file
BIN
clase_2/ejercicios/~$ercicios.docx
Normal file
Binary file not shown.
Loading…
Reference in New Issue
Block a user