Created
September 19, 2018 16:50
-
-
Save Dhrumilcse/15935ce5fda8c0e70ad084f62b528595 to your computer and use it in GitHub Desktop.
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
def fitness (password, test_word): | |
if (len(test_word) != len(password)): | |
print("taille incompatible") | |
return | |
else: | |
score = 0 | |
i = 0 | |
while (i < len(password)): | |
if (password[i] == test_word[i]): | |
score+=1 | |
i+=1 | |
return score * 100 / len(password) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment