简体   繁体   中英

While loop is not working as expected

After I build and run the code, "Enter word: " is output once and that's it. 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. That's why it's not doing anything after you type a word and hit enter. Check out this post for a python workout:

Sublime Text Console Input

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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