Question: In Python: define and invoke main, don't use if __name__ == '__main__':, and also do not hard code, it asks so it's about inputs. Write

In Python: define and invoke main, don't use if __name__ == '__main__':, and also do not hard code, it asks so it's about inputs.

In Python: define and invoke main, don't use if __name__ == '__main__':,

Write a program that asks the user for the name of file of addresses and a name of an output file. Your program should replace all occurrences of "NY" with "New York", all occurrences of "NJ" with "New Jersey", and all occurrences of "CT" with "Connecticut" and write the results to the output file. For example, if the input file contains: from wikipedia: NY-NJ-CT Tri-State Area The NY metropolitan area includes the most populous city in the United States (NY City); counties comprising Long Island and the Mid- and Lower Hudson Valley in the state of New York; the five largest cities in NJ and their vicinities; six of the seven largest cities in CT and their vicinities; and five counties in Northeast Pennsylvania. Then the output file should be: from wikipedia: New York-New Jersey-Connecticut Tri-State Area The New York metropolitan area includes the most populous city in the United States (New York City); counties comprising Long Island and the Mid- and Lower Hudson Valley in the state of New York; the five largest cities in New Jersey and their vicinities; six of the seven largest cities in Connecticut and their vicinities; and five counties in Northeast Pennsylvania. Hint: do each replacement one-by-one, that is, first get your program to replace all the "NY"s with "New York's and then go on to the next states

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!