-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PYTHON Ejercicio 40.- Excepciones [92]🐍👈👈👈
Video: https://youtu.be/mHkpVVvb2kk
- Loading branch information
1 parent
967e5b0
commit b2f9017
Showing
1 changed file
with
22 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |