NEXIGO Tutorial 5-81 ( x B Tutorial 5 recording (by TA Alex O Tutorial 5 - Merge COMP1005A: X G Write a function called print han content/82886/viewContent/2138118/View Problem 4 Write a program...


NEXIGO<br>Tutorial 5-81 ( x<br>B Tutorial 5 recording (by TA Alex<br>O Tutorial 5 - Merge COMP1005A: X<br>G Write a function called print han<br>content/82886/viewContent/2138118/View<br>Problem 4<br>Write a program called p4.py. Fill in the rest of the program, making use of the functions above,<br>so that it does the following:<br>1. prompts the user to guess a character<br>2. validates the input. If input is invalid, then a message indicating so should be printed and<br>the user should be prompted again.<br>3. Check if the character is in the word and print the word where only the guessed<br>character is revealed, the rest of the letters should be replaced by underscores.<br>4. If the character is not in the word, then the number of incorrect guesses should be<br>incremented<br>5. the hangman should be printed to reflect the number of incorrect guesses<br>6. the program should infinitely prompt the user to guess a character (repeating steps 1-5)<br>until either the user enters 'quit' or the number of incorrect guesses reaches 6<br>Sample output -1:<br>Guess a letter: 5<br>Invalid input, please try again.<br>Guess a letter: A<br>a_a<br>Guess a letter:<br>Guess a letter:<br>Guess a letter: k<br>Guess a letter: quit<br>The word was 'koala<br>Goodbye<br>3<br>16<br>

Extracted text: NEXIGO Tutorial 5-81 ( x B Tutorial 5 recording (by TA Alex O Tutorial 5 - Merge COMP1005A: X G Write a function called print han content/82886/viewContent/2138118/View Problem 4 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 -1: Guess a letter: 5 Invalid input, please try again. Guess a letter: A a_a Guess a letter: Guess a letter: Guess a letter: k Guess a letter: quit The word was 'koala Goodbye 3 16
Tutorial 5- B1 ( X<br>B Tutorial 5 recording (by TA Alex x<br>B Tutorial 5 - Merge COMP1005A: X<br>G Write a function called print han<br>content/82886/viewContent/2138118/View<br>Sample output - 2:<br>Guess a letter:<br>Gueas a letter:<br>Guess a letter:<br>Guess a letter:<br>kk_<br>Guess a letter:<br>Guess a letter:<br>kk_<br>Guess a letter: quit<br>The word was 'quokka<br>Goodbye<br>Sample output - 3:<br>Guess a letter: A<br>Guess a letter:<br>Guess a letter: u<br>Guess a letter:<br>

Extracted text: Tutorial 5- B1 ( X B Tutorial 5 recording (by TA Alex x B Tutorial 5 - Merge COMP1005A: X G Write a function called print han content/82886/viewContent/2138118/View Sample output - 2: Guess a letter: Gueas a letter: Guess a letter: Guess a letter: kk_ Guess a letter: Guess a letter: kk_ Guess a letter: quit The word was 'quokka Goodbye Sample output - 3: Guess a letter: A Guess a letter: Guess a letter: u Guess a letter:
Jun 11, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here