📜  字符串索引超出范围python代码示例

📅  最后修改于: 2022-03-11 14:46:59.931000             🧑  作者: Mango

代码示例1
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