I'm here for my young son. I need your help.
How do you 1) make a right answer to any one of several answers. And how do you 2) create several input prompts that will display if an answer is wrong. For example, the program is supposed to let a user guess the secret_word = "love". (The prompt says "it's what the world needs now". If you know the song, the lyric then goes "love sweet love".)
Anyway, the user might type in "Love" or "LOVE" or "Love sweet love" or "LOVE SWEET LOVE" or whatever. I'm willing to accept those and many other answers as correct. How do I program that? See my code below.
The second problem is linked to this. Should they get a wrong answer, like "politicians", my while loop gives them 2 more tries. Each try I want a DIFFERENT prompt, such as "Oops. Not quite, give it one more try" or "Here's a clue, it begins with L". How do I code that. Anyway, thanks again. Here's that code. Tell me what you think:
secret_word = "love"
# I want these options too: "LOVE", " Love", "love sweet love",
guess=""
guess_count = 0
guess_limit = 3
out_of_guesses = False
while guess != secret_word and not(out_of_guesses):
if guess_count < guess_limit:
guess = input("Guess the guess-word. 3 tries. (It's 'what the world needs now'): ")
guess_count += 1
else:
out_of_guesses = True
if out_of_guesses:
print("Out of Guesses! You lose! The answer was " + secret_word + "!")
else:
print("You're right! You win! It IS " + secret_word + "! Fantastic job.")