Question: Question: Write a python script that will read in the attached file (input.txt), swap the two columns, and print them back out. See attached outfile.txt

Question: Write a python script that will read in the attached file (input.txt), swap the two columns, and print them back out. See attached outfile.txt for an example.

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++.

(input.txt) First,Last Bill,Logger Hannah,Flowers Bob,Cratchet Chris,Craft Tom,Thumb Fred,Bird Stephen,Stone Ashley,Stone

(outfile.txt) (Expected Answer) Last,First Logger,Bill Flowers,Hannah Cratchet,Bob Craft,Chris Thumb,Tom Bird,Fred Stone,Stephen Stone,Ashley

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!