Write a program called p4.py. Fill in the rest of the program, making use of the functions above, so that it does the following: 1. prompts the user to guess a character 2. validates the input. If input is invalid, then a message indicating so should be printed and the user should be prompted again. 3. Check if the character is in the word and print the word where only the guessed character is revealed, the rest of the letters should be replaced by underscores. 4. If the character is not in the word, then the number of incorrect guesses should be incremented 5. the hangman should be printed to reflect the number of incorrect guesses 6. the program should infinitely prompt the user to guess a character (repeating steps 1-5) until either the user enters ‘quit’ or the number of incorrect guesses reaches 6 Sample output (in the image pasted)
Write a
1. prompts the user to guess a character
2. validates the input. If input is invalid, then a message indicating so should be printed and the user should be prompted again.
3. Check if the character is in the word and print the word where only the guessed character is revealed, the rest of the letters should be replaced by underscores.
4. If the character is not in the word, then the number of incorrect guesses should be incremented
5. the hangman should be printed to reflect the number of incorrect guesses
6. the program should infinitely prompt the user to guess a character (repeating steps 1-5) until either the user enters ‘quit’ or the number of incorrect guesses reaches 6
Sample output (in the image pasted)
Step by step
Solved in 3 steps with 4 images