Combine loops and conditionals to build a word guessing game. The secret word is stored in your code — the user keeps guessing until they get it or run out of tries.
YOUR TASK
Create a program that:
Stores a secret word (use "python")
Gives the user up to 5 attempts to guess it
Prints Wrong! for each incorrect guess
Prints Correct! when they guess right
Prints Game over! if they run out of tries
Need a hint?
Step-by-step:
1. secret = "python"
2. attempts = 5
3. Use a loop: for i in range(attempts):
4. guess = input("Guess the word: ")
5. If guess matches secret → print "Correct!" and break
6. Else → print "Wrong!"
7. After loop (no break) → print "Game over!"
Example (inputs: java, then python):
Guess the word: java
Wrong!
Guess the word: python
Correct!
Code Editor Ready
Output
Console
Console initialized...
Ready for Project 4: Secret Word Game
> Test your code with the "Check My Code" button
> When it works, the Complete button will activate!