简体   繁体   English

While循环未按预期工作

[英]While loop is not working as expected

After I build and run the code, "Enter word: " is output once and that's it. 构建并运行代码后,将输出一次“ Enter word:”,仅此而已。 Stays blank after entering any word. 输入任何单词后保持空白。 What am I missing? 我想念什么? Here's the code: 这是代码:

word = "cool"
guess = " "

while guess != word:
    guess = input("Enter word: ")

print("you win!")

The code is fine. 代码很好。 You just can't input in the Sublime Text terminal from the standard download. 您只是无法从标准下载中输入Sublime Text终端。 That's why it's not doing anything after you type a word and hit enter. 这就是为什么在您输入单词并按Enter键后它什么也不做的原因。 Check out this post for a python workout: 查看此帖子以进行python锻炼:

Sublime Text Console Input Sublime Text控制台输入

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM