Jun-04-2020, 04:41 PM
(Jun-04-2020, 02:26 PM)Clunk_Head Wrote: The find function returns the index of the first instance found. That's why it stops working after the first one is found. If it doesn't find an instance then it returns -1. What you need to do is keep running find in a loop until it returns -1.
Something like:
while full_word.find(guess): selected_word = selected_word[:checker] + guess + selected_word[checker+1:]
I'm not getting this to work. Wouldn't it still just have the same problem? full_word is the original word, and selected_word is the starred out version. If I just keep running .find on full_word with guess, surely it would still keep ending at the first index?