Question: The following program used in the class requires that .txt be added by the user to every filename entered. Modify the program to automatically add

The following program used in the class requires that .txt be added by the user to every filename entered. Modify the program to automatically add .txt to the name entered, such that the user only provides the username without .txt. E.g. Before modification, user enters: 'class_abc.txt' After modification, user enters: 'class_abc' f_name=input("Please enter the name of the file to load: ") loaded_file=open (f_name, 'r') line_empty " for line in loaded_file: print(line.strip (' ')) print("We finished reading the file!!!") print ("We are happy!") loaded_file.close()
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
