Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
simple guessing game in pyhton.
# Variables to store my secret and guess from user input.
secret_word = "giraffe"
guess = ""
# guesses flages.
guess_count = 0
guess_limit = 3
out_of_order = False
# Lopping through to check whether the user has entered correct secret word and he/she is not out of order.
while guess != secret_word and not out_of_order:
if guess_count < guess_limit:
guess = input("Enter your guess: ")
guess_count += 1
out_of_order = True
if out_of_order:
print("Out of guesses, You Lose!")
print("You Win!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.