diff --git a/clase_4/excep.py b/clase_4/excep.py new file mode 100644 index 0000000..f69c858 --- /dev/null +++ b/clase_4/excep.py @@ -0,0 +1,12 @@ +try: + numero_1 = int(input("Ingrese un mumero ")) + numero_2 = int(input("Ingrese otro numero ")) + + division= numero_1 / numero_2 +except Exception as error: + print(f"Ocurrio un error: {type(error)}") #ValueError + +else: + print(f"la division es { division}") +finally: + print("el proceso finalizó correctamente") \ No newline at end of file diff --git a/clase_4/main.py b/clase_4/main.py index 98fd821..cfc1b54 100644 --- a/clase_4/main.py +++ b/clase_4/main.py @@ -1,15 +1,7 @@ -#import mi_modulo import mi_modulo as mod -#from mi_modulo import tabla, saludame +mod.tabla(5) +print(mod.saludame("Cristian")) - - - -mod.tabla(2) -print(mod.saludame("Pau")) -#mi_modulo.tabla(2) -#print(mi_modulo.saludame("Cristian")) - -from my_package import herramientas, pruebas -pruebas.probando() -herramientas.nombreCompleto("Nair", "Galarza") \ No newline at end of file +#from my_package import herramientas, pruebas +#pruebas.probando() +#herramientas.nombreCompleto("Nair", "Galarza") \ No newline at end of file diff --git a/clase_5/excep.py b/clase_5/excep.py new file mode 100644 index 0000000..088ca11 --- /dev/null +++ b/clase_5/excep.py @@ -0,0 +1,18 @@ +try: + numero_1 = int(input("ingrese un numero")) + numero_2= int(input("ingrese otro numero")) + + division= numero_1 / numero_2 +except ValueError: + print("ingrese un entero") +except ZeroDivisionError: + print("No se puede dividir por 0") +else: + print(f"la division es {division}") +finally: + print("el programa finalizó") + + +lista = [1,2,4] + +print(lista[5]) \ No newline at end of file diff --git a/clase_5/main.py b/clase_5/main.py new file mode 100644 index 0000000..2ce344b --- /dev/null +++ b/clase_5/main.py @@ -0,0 +1,14 @@ +#import mi_modulo as mod + +#mod.tabla(4) +#print(mod.saludo("Cristian")) + +from mi_modulo import tabla +from new_paquete import operaciones, herramientas + +tabla(5) + +print(operaciones.suma(5,5)) +print(herramientas.saludo()) + + diff --git a/clase_5/mi_modulo.py b/clase_5/mi_modulo.py new file mode 100644 index 0000000..2f4184a --- /dev/null +++ b/clase_5/mi_modulo.py @@ -0,0 +1,11 @@ + +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}") + + +def saludo (nombre): + sal= f"hola {nombre} como estas" + return sal \ No newline at end of file diff --git a/clase_5/new_paquete/__init__.py b/clase_5/new_paquete/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/clase_5/new_paquete/herramientas.py b/clase_5/new_paquete/herramientas.py new file mode 100644 index 0000000..99c8377 --- /dev/null +++ b/clase_5/new_paquete/herramientas.py @@ -0,0 +1,3 @@ + +def saludo(): + return f"soy un paquete" \ No newline at end of file diff --git a/clase_5/new_paquete/operaciones.py b/clase_5/new_paquete/operaciones.py new file mode 100644 index 0000000..8e25e28 --- /dev/null +++ b/clase_5/new_paquete/operaciones.py @@ -0,0 +1,3 @@ + +def suma (numero1 , numero2): + return numero1 + numero2 \ No newline at end of file