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 IFThenELSE and TRYExcept 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 inputWhat file?"
printWORD COUNTER."
looker inputWhat word are you looking for?"
#open file
with openfilename as fileobject:
#read file into a single variable called contents
contents fileobject.read
contents contents.replace
count
while count
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
