how to make algorithm for the second CPF checker code for Python?

Asked

Viewed 14 times

0

while True:

cpf = input("Digite n: ")


novo_cpf = cpf[:-2]
soma_digitos = 0
lista_digitos = []

for key, index in enumerate(novo_cpf):
    key_reverso = len(novo_cpf) + 1 - key
    lista_digitos.append(key_reverso * int(index))
    soma_digitos += lista_digitos[key]

d = 11 - (soma_digitos % 11)

if(d > 9):
    d = 11 - d




print(d)
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.