Question: I need assistance with my python code copied below. Add IF / Then / ELSE and TRY / Except commands to make the code more

I need assistance with my python code copied below. Add IF/Then/ELSE and TRY/Except commands to make the code more user friendly so it doesn't crash. Include a list of errors you are checking for in the comments at the top of the program.
# set filename
filename = input("What file?")
print("WORD COUNTER.")
looker = input("What word are you looking for?")
#open file
with open(filename) as file_object:
#read file into a single variable called contents
contents = file_object.read()
contents = contents.replace("
","")
count =0
while (count

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 Accounting Questions!