Posted on 2019-10-23跟随教程练习的Python小小小程序 sercet_word = "test" guess = "" guess_count = 0 guess_limit = 3 out_of_guesses = False while guess != sercet_word and not out_of_guesses: if guess_count < guess_limit: guess = input("Guess the word: ") guess_count += 1 else: out_of_guesses = True if out_of_guesses: print("Out of guesses,You lose!") else: print("You Win!") 跟随教程练习了这么一个小程序,将if、loop、input等都运用上了,虽然很简单,但是尽量让自己的思维方式与程序员靠近。