Python 当浏览一些if和elif子句时,它只会在其中一个中停止?

Python 当浏览一些if和elif子句时,它只会在其中一个中停止?,python,if-statement,Python,If Statement,你好,我正在做python作业。现在我在中学,我在python方面非常差,因为我已经很久没有接触过它了。因此,我有一个关于python整体工作原理的无趣问题 choice = input("Pick a letter that you think is in the word: ") if choice in right or choice in wrong or choice not in abc: print("Oops! This letter has already been

你好,我正在做python作业。现在我在中学,我在python方面非常差,因为我已经很久没有接触过它了。因此,我有一个关于python整体工作原理的无趣问题

choice = input("Pick a letter that you think is in the word: ") 
if choice in right or choice in wrong or choice not in abc:
    print("Oops! This letter has already been guessed or it's not a letter at all!")
    return
elif choice == realone:
    one = choice
    right.append(choice)
elif choice == realtwo:
    two = choice
    right.append(choice)
elif choice == realthree:
    three = choice
    right.append(choice)
elif choice == realfour:
    four = choice
    right.append(choice)
elif choice == realfive:
    five = choice
    right.append(choice)
elif choice == realsix:
    six = choice
    right.append(choice)
else:
    guesses = guesses - 1
    wrong.append(choice)

让我解释一下。这是我的刽子手密码的一部分。选择是玩家猜测的角色。实数(somenumber)变量是单词的实数字母。前面没有实数的数字1、2、3用于显示字符是否正确。然而,当一个单词被挑选出来,并且有重复的字符(加合)时,它就有点失败了。所以当我输入d时,它只显示加合物中的一个d(第一个)。我认为它通过了if-elif条款,当它变成一个条款时,它就不会走得更远了。有人有什么建议吗?如果可能,请解释:)

当满足特定条件,并且它属于特定的elif子句时,为什么要进一步解释?这就是if elif条款的全部要点。如果你想让它更进一步,只需要使用ifs而不是elifs。为什么你要对单词的字母使用单独的变量呢?使用列表。那么你根本就不需要
if
语句。我需要把它们分开,因为这样我就知道这个人猜到了哪个字符。“如果他们把它改对了,那就没用了,我甚至不知道他们把哪个字符改对了。”哈瓦那拉瓦尔感谢if子句的建议。你是个活生生的救星