【发布时间】:2019-04-26 12:28:15
【问题描述】:
secret_word = "giraffe"
guess = ""
while guess != secret_word:
guess = input("Enter your guess: ")
print("Bravo, you've guessed it right!")
【问题讨论】:
-
在 Python 3.4 和 3.7.1 中似乎都可以正常工作。你能提供你的代码和终端的图片吗?
-
@Deathraider26 您可以在每行代码前面使用 4 个空格将其格式化为代码。
-
请编辑您的问题标题。
-
我尝试在 Spyder 中运行相同的程序,它成功了。奇怪!
标签: python python-3.x loops while-loop