fname=input("Enter a file's name: ")with open(fname, 'r') as fh:for line in fh:print(line)Criteria to complete the above snippet:1)Code will keep looping until the user enters an existing file...

fname=input("Enter a file's name: ") with open(fname, 'r') as fh: for line in fh: print(line) Criteria to complete the above snippet: 1)Code will keep looping until the user enters an existing file name. 2) need to use exception with [Error 7] as the message 3)need to catch the exception so the program does not crash 4) close the program after reading contents of the file and print contents to the screen 5)create a test file

Jun 10, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here