from itertools import cycle

def digito_verificador(rut):
    reversed_digits = map(int, reversed(str(rut)))
    factors = cycle(range(2, 8))
    s = sum(d * f for d, f in zip(reversed_digits, factors))
    
    return "K" if (-s) % 11 == 10 else (-s) % 11

# =SI(pruebalogica;valorverdadero;valorfalso)
# valorverdadero IF pruebalogica ELSE valorsfalso

print(digito_verificador(13940193))
a81c244df996ce30c486cea2a46b4be647640811
<mask token>

<mask token>


def digito_verificador(rut):
    reversed_digits = map(int, reversed(str(rut)))
    factors = cycle(range(2, 8))
    s = sum(d * f for d, f in zip(reversed_digits, factors))
    return 'K' if -s % 11 == 10 else -s % 11


<mask token>

<mask token>


def digito_verificador(rut):
    reversed_digits = map(int, reversed(str(rut)))
    factors = cycle(range(2, 8))
    s = sum(d * f for d, f in zip(reversed_digits, factors))
    return 'K' if -s % 11 == 10 else -s % 11


print(digito_verificador(13940193))

from itertools import cycle


def digito_verificador(rut):
    reversed_digits = map(int, reversed(str(rut)))
    factors = cycle(range(2, 8))
    s = sum(d * f for d, f in zip(reversed_digits, factors))
    return 'K' if -s % 11 == 10 else -s % 11


print(digito_verificador(13940193))

from itertools import cycle

def digito_verificador(rut):
    reversed_digits = map(int, reversed(str(rut)))
    factors = cycle(range(2, 8))
    s = sum(d * f for d, f in zip(reversed_digits, factors))
    
    return "K" if (-s) % 11 == 10 else (-s) % 11

# =SI(pruebalogica;valorverdadero;valorfalso)
# valorverdadero IF pruebalogica ELSE valorsfalso

print(digito_verificador(13940193))