I was writing this simple code in Python to make a guessing game and it works with a word. But i want it to recognize the word if any part of it is capitalized. I'm a begginer in Python so ignore my mistakes. Posting some code here;
word = "no"
word2 = "No"
word3 = "NO"
guess = ""
guess_count = 0
guess_limit = 3
out_of_guesses = False
print("-----GUESS THE WORD!-----")
print("Which word comes here? ---> __ .")
while guess != word and not(out_of_guesses):
if guess_count < guess_limit:
guess = input("Enter Your Guess: ")
guess_count += 1
else:
out_of_guesses = True
if out_of_guesses:
print("You are out of guesses, You Lose! ")
else:
print("You are Right!")
print('The Word was "no".')
This code works but i want it to consider the variables: word 2 and word 3. This is the code that doesn't work.
word = "no"
word2 = "No"
word3 = "NO"
guess = ""
guess_count = 0
guess_limit = 3
out_of_guesses = False
print("-----GUESS THE WORD!-----")
print("Which word comes here? ---> __ .")
while guess != word or guess != word2 or guess != word3 and not(out_of_guesses):
if guess_count < guess_limit:
guess = input("Enter Your Guess: ")
guess_count += 1
else:
out_of_guesses = True
if out_of_guesses:
print("You are out of guesses, You Lose! ")
else:
print("You are Right!")
print('The Word was "no".')
I would love to hear about a solution or a better way to do the same.