Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro Database Migration To Azure Data Modernization For The Enterprise

Authors: Kevin Kline, Denis McDowell, Dustin Dorsey, Matt Gordon

1st Edition

1484282299, 978-1484282298

More Books

Students also viewed these Databases questions

Question

Define mediator variable.

Answered: 1 week ago

Question

Explain the Pascals Law ?

Answered: 1 week ago

Question

What are the objectives of performance appraisal ?

Answered: 1 week ago

Question

State the uses of job description.

Answered: 1 week ago