[Python] Guessing game with while loop
This time we're going to make Guessing game.. with While Loop that we learned last time. print ( "Food name" ) secret_word = "pasta" guess = "" I made secret_word while guess != secret_word : guess = input ( "Enter guess: " ) print ( "Try more~" ) print ( "You win!" ) != means "not equal" so if the guess is not equal to secret_word, it's going to continue to loop through Let's play Food name Enter guess : pizza Try more~ Enter guess : sushi Try more~ and when the guess is right You win! You can set up "limit" to make it more fun guess_count = 0 guess_limit = 3 out_of_guesses = False I make count, limit, and out of guess while guess != secret_word and not ( out_of_guesses ): if guess_count < guess_limit : guess = input ( "Enter guess: " ) guess_count += 1 print ( "try more~" ) else : ou...