Question: Write a program in which the user is asked to guess the name of your favorite DBVac vacuum cleaner model. Your program should: Include comments
Write a program in which the user is asked to guess the name of your favorite DBVac vacuum cleaner model. Your program should:
- Include comments describing each major section of code.
- Set a variable called favvac to be equal to the name of your favorite DBVac vacuum cleaner model (e.g., Bunny King).
- Ask the user to guess the name. Allow the user to make up to four guesses, evaluating each guess for correctness immediately after the guess is made.
- The users guess shouldnt be required to be case sensitive to be correct. For instance, if your favorite model is the Hare Razer, but the user inputs HARE RAZER, then that should be counted correct (as should hare razer, hArE rAzEr and any other combination of capital and lower-case letters).
- If the user guesses wrong, let them know, tell them how many guesses they have left, and have them guess again (up to four guesses total).
- If the user is down to their last guess, give them a hint by telling them what the first letter of the vacuum cleaner model is. To do this, use the variable (favvac) and an index value.
- If the user guesses the correct name:
- Stop asking the user to guess (even if they have not yet guessed four times).
- Congratulate the user on their guessing skills.
- Tell the user how many guesses it took them to guess correctly.
- If the user runs out of guesses without guessing the correct name:
- Console the user by telling them that, while they have failed in this task, its going to be okay.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
