Question: Please use comments as much as possible and please do the bonus questions too. Task: To complete this assignment, you should write a Python program
Please use comments as much as possible and please do the bonus questions too.
Task: To complete this assignment, you should write a Python program that allows users to guess words from a book title of your choosing.
- Output a welcome message describing the application for the user and any/all instructions
- Output the author, year, and genre of the book title they are trying to guess (output from variables)
- Output the number of words in the title programmatically (choose a title with more than one word) HINT: Research the split() (Links to an external site.)Links to an external site. function and len() (Links to an external site.)Links to an external site. function and utilize them to find the number of words in your title programmatically
- Ask the user to guess a word in the title using input()
- Store their guess in a variable and name the variable appropriately
- Use the in operation first, then test the result with an if:else statement to see if the word they guessed is in the title string of the book HINT: In order to test the input against the title words appropriately, consider the case of the word. If the user gave you a capitalized word and the title word is not capitalized (or vice versa), how can you ensure that the if:else test matches it? You need to utilize a command to either lower-case strings or upper-case strings BEFORE testing in the if:else.
- Output the results from the user's guess and the complete title. Tell them they are correct or incorrect, then output the complete title, author, year and genre.
Bonus Points: For this assignment, I will give you a full extra point if you can:
- Utilize the while() (Links to an external site.)Links to an external site. loop to allow the user to guess multiple times (limit it to 5 or 10 loops) NOTE: We will cover the while() loop in class soon, but for those of you who have experience with programming (or those of you who are willing to try it) I like to give you options to show of your skills.
- If you are going to use a loop, try to add a counter to output the user's score once they succeed (e.g., "You guessed 3 out of the 5 title words in 5 attempts").
- Allow the user to QUIT at any time (e.g., In the instructions, let them know they can quit at any time by typing "QUIT" at the prompt).
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
