Skip to content

Instantly share code, notes, and snippets.

@rodabt
Last active January 8, 2019 12:37
Show Gist options
  • Save rodabt/692668ec811a49ad33bf5b275a254fb6 to your computer and use it in GitHub Desktop.
Save rodabt/692668ec811a49ad33bf5b275a254fb6 to your computer and use it in GitHub Desktop.
Función de una línea para dígito verificador de RUT en Python
def dv(n):
return 'K' if (11-sum([int(j)*(i%6+2) for i,j in enumerate(str(n)[::-1])])%11)%11==10 else (11-sum([int(j)*(i%6+2) for i,j in enumerate(str(n)[::-1])])%11)%11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment