Question: Please code in python 3 This exercise is designed to give you experience looping over files and making decisions based on their contents. The program

Please code in python 3

Please code in python 3 This exercise is designed to give you

This exercise is designed to give you experience looping over files and making decisions based on their contents. The program asks the user for three pieces of information. A text file to open A letter to search for . A position to look in The program counts how many words have the given character in the correct position. For example, the previous sentence contains 5 words with o in position 1 Your program must check for errors. If an error is encountered, call sys.exit(0) after printing a message If the file cannot be opened, then print an error. (Hint: Use a try/except with OSError) Welcome to Book Analyzer vo.1 Enter File Name to Read fake name.txt Error: Could Not Open File Print an error if something other then a single letter is given to search for. Enter File Name to Read modest.txt Letter to search for A Bad Input Error: A single letter is required Print an error if the third input is not a number Welcome to Book Analyzer vo.1 Enter File Name to Read modest.txt Letter to search for Enter Position (0 for first letter TwO Error: A number is required If all inputs are good, then you can read the file. Get each word out of the file and check it against the inputs. Count how many words appear with the character given in the correct location. Welcome to Book Analyzer vo.1 Enter File Name to Read modest.txt Letter to search for h. Enter Position (0 for first letter There are 853 words with h in position 1 You should count both the upper and lower case versions of a letter. If the user enters a, then mean count both A and a. You can use str_var.lower0 to make a string lowercase The two files are: modest.txt and poe.txt This exercise is designed to give you experience looping over files and making decisions based on their contents. The program asks the user for three pieces of information. A text file to open A letter to search for . A position to look in The program counts how many words have the given character in the correct position. For example, the previous sentence contains 5 words with o in position 1 Your program must check for errors. If an error is encountered, call sys.exit(0) after printing a message If the file cannot be opened, then print an error. (Hint: Use a try/except with OSError) Welcome to Book Analyzer vo.1 Enter File Name to Read fake name.txt Error: Could Not Open File Print an error if something other then a single letter is given to search for. Enter File Name to Read modest.txt Letter to search for A Bad Input Error: A single letter is required Print an error if the third input is not a number Welcome to Book Analyzer vo.1 Enter File Name to Read modest.txt Letter to search for Enter Position (0 for first letter TwO Error: A number is required If all inputs are good, then you can read the file. Get each word out of the file and check it against the inputs. Count how many words appear with the character given in the correct location. Welcome to Book Analyzer vo.1 Enter File Name to Read modest.txt Letter to search for h. Enter Position (0 for first letter There are 853 words with h in position 1 You should count both the upper and lower case versions of a letter. If the user enters a, then mean count both A and a. You can use str_var.lower0 to make a string lowercase The two files are: modest.txt and poe.txt

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!