Question: The input file will have many lines. Each line will be stored as a string in your program. Each string will be placed in a

The input file will have many lines. Each line will be stored as a string in your program.
Each string will be placed in a list, so that each item in the list will correspond to a line
in the file.
1. Create a list (array-based sequence) of strings.
2. Read the text file.
3. Save each line as a string and add it to the list, in the order in which they are
read from the file.To open the file for reading, you must use the command:
f = open(inputFileName,"r")
Be careful, if you program can't find the file that it is looking for it will crash.
At this point you can read the lines from the file using:
myList = f.readlines()
This will read the whole file and store each line as an item in the list of strings myList .
Don't forget to close the file after you finish reading it:
f.close()
Process the List
In the main body of your program, loop through the list of strings and, for each item in
the list, call the arrange() function passing that item as a parameter. The function will
return the modified string, which you will print. You do not need to update the list of
strings.

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