Skip to content

Commit

Permalink
PYTHON Ejercicio 40.- Excepciones [92]🐍👈👈👈
Browse files Browse the repository at this point in the history
  • Loading branch information
programadornovato committed Jul 23, 2020
1 parent 967e5b0 commit b2f9017
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions ejercicios/40ExcepcionNumero.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
def leerNumero():
while True:
valor=input("Humano ingres un numero que sea un numero:")
try:
numero=int(valor)
return numero
except ValueError as ex:
print(f"Humano tonto el valor '{valor}' no es numero intentalo de nuevo ",ex)
lista=[]
print("Ingresa una lista de numeros (0 para terminar)")
while True:
numero=leerNumero()
if numero==0:
break
else:
lista.append(numero)

print("Humano ingresa un indice de tu lista: ",lista)
try:
print(f"Este es el numero de tu indice ",lista[leerNumero()])
except IndexError as ex:
print("El indice no esta en la lista ",ex)

0 comments on commit b2f9017

Please sign in to comment.