因此,当我编写一个简单的刽子手游戏以获得乐趣时,因为初学者我仍然需要帮助:
我希望我的算法测试输入是否只有一个字符,例如:
while True:
x=str(input())
#code checking wheather it is only one character, if it is
character break and stop the loop,
otherwise repeat the input
Run Code Online (Sandbox Code Playgroud)让我说我的秘密词是'billy'
我想知道如何检查这一个字母输入是否与秘密词中的任何一个字母相同.例如
if x *code checking if the input has a same letter as the secret word*:
#carry on program
Run Code Online (Sandbox Code Playgroud)如果你可以帮助我解决这两个问题中的任何一个问题,你就可以成为救星!