我必须创建一个游戏,其中计算机选择一个随机单词,玩家必须猜测该单词。电脑会告诉玩家单词中有多少个字母。然后玩家有五次机会询问单词中是否有字母。计算机只能用"yes"
或响应"no"
。然后,玩家必须猜出这个词。我只有:
import random
WORDS = ("python", "jumble", "easy", "difficult", "answer", "xylophone", "truck" , "doom" , "mayonase" ,"flying" ,"magic" ,"mine" ,"bugle")
word = random.choice(WORDS)
print(len(word))
correct = word
guess = input("\nYour guess: ")
if guess != correct and guess != "" :
print("No.")
if guess == correct:
print("Yes!\n")
我不知道如何解决这个问题。