I'm making a mastermind game (the one where you gotta guess the password and it tells you how many of the codes you got right when you tried). BUUUUUT, I'm doing mine with a single word, and not multiple words or colors
answer = "this"
given = "that"
print(str(answer - given) + "/4 correct")
>>> "2/4 correct"
I need to find a way to find the number of characters the variables have this way based on the order they're in.
Here's the original program the code is trying to run in, in case it is needed:
What I have tried:
I've tried using:
crct = len([i for i, j in zip(a,b) if i == j])
gmtxt("> Entry denied \n> "+str(crct)+"/4 correct.")
but it either comes up as "0" or error.
I've also tried turning the variables into lists, and that seems to get me the closest, but it still doesn't work as I had hoped.