Question: How would you go about solving this program in Python? Please write a python script which will read in the attached file (input.txt) and then

How would you go about solving this program in Python?

How would you go about solving this program in Python? Please write

Please write a python script which will read in the attached file (input.txt) and then write it back to another file named out.txt adding line numbers to the file. Input.txt looks like person 1 person2 person3 person4 The attached file outfile.txt is what you file should look like. 1.) person1 2.) person2 3.) person3 4.) person4 In this exercise, you will explore lists and strings in python. Hints: You can use the read line method to return the whole line of text. What you will find is that the line is a list type. The list type is what we would think of as an array in C++. So strings are in some way the same handled the same in Python as C++. In this exercise, you will need a counter variable to be incremented with each line. Then to print that to the out file you will need to then cast the number variable to a string and concatenate it to your line

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