小编Uda*_*tel的帖子

条件计数循环Python

我试图找出我的错误在下面的代码中,这是关于猜一个字.

如果我输入缺失的单词,"ghost"它应该结束游戏,但它会继续要求它.

我的错误在哪里?

number = 0
missword = "ghost"
while number < 3:
    guess = input("What is the missing word? ")
    if guess != "ghost":
        print("Try again")
        number = number + 1
    elif guess == missword:
        print("Game Over")
    else:
        print("Game over")
Run Code Online (Sandbox Code Playgroud)

python

0
推荐指数
1
解决办法
446
查看次数

标签 统计

python ×1