clase 5
This commit is contained in:
parent
fa2f64c5e9
commit
d0f39b6ab5
12
clase_4/excep.py
Normal file
12
clase_4/excep.py
Normal file
|
|
@ -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")
|
||||
|
|
@ -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")
|
||||
#from my_package import herramientas, pruebas
|
||||
#pruebas.probando()
|
||||
#herramientas.nombreCompleto("Nair", "Galarza")
|
||||
18
clase_5/excep.py
Normal file
18
clase_5/excep.py
Normal file
|
|
@ -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])
|
||||
14
clase_5/main.py
Normal file
14
clase_5/main.py
Normal file
|
|
@ -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())
|
||||
|
||||
|
||||
11
clase_5/mi_modulo.py
Normal file
11
clase_5/mi_modulo.py
Normal file
|
|
@ -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
|
||||
0
clase_5/new_paquete/__init__.py
Normal file
0
clase_5/new_paquete/__init__.py
Normal file
3
clase_5/new_paquete/herramientas.py
Normal file
3
clase_5/new_paquete/herramientas.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
|
||||
def saludo():
|
||||
return f"soy un paquete"
|
||||
3
clase_5/new_paquete/operaciones.py
Normal file
3
clase_5/new_paquete/operaciones.py
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
|
||||
def suma (numero1 , numero2):
|
||||
return numero1 + numero2
|
||||
Loading…
Reference in New Issue
Block a user