您好像缩进
so_far = new得太多了。尝试这个:
if guess in word: print("nYes!", guess, "is in the word!") # Create a new variable (so_far) to contain the guess new = "" i = 0 for i in range(len(word)): if guess == word[i]: new += guess else: new += so_far[i] so_far = new # unindented this