validar rut con guion sin puntos
Publicado por m (3 intervenciones) el 10/07/2020 00:51:59
hola necesito ayuda validar un rut que el usuario al ingresar su rut si llega a poner un na letra salga error
Valora esta pregunta


0


while True:print("Ingrese su rut")
rut = input("Rut >")
if rut[0:8].isnumeric():
print("Paso a nivel 0")
if len(rut) == 10:
print("Paso a nivel 1")
if rut.find("-") == 8:
print("Paso a nivel 2")
else:print("Ingreso mal el guion")
else:print("No ingrese mas de 10 caracteres")
else:print("Ingreso letras")


step = 1while step == 1:
try:rut = str(input('Ingrese rut (formato 05555555-5): '))
assert len(rut) == 10 and rut.find("-") == 8
step = step + 1
except AssertionError:print("ERROR 1: Debe ingresar el RUT sin puntos y con el guion antes del digito verificador.")
print(f"Su rut es {rut}")

