Question: In Python: The 44 lines of the file PresStates.txt contain the names of the states that produced each of the first 44 presidents. The first

In Python:

The 44 lines of the file PresStates.txt contain the names of the states that produced each of the first 44 presidents. The first four lines of the file contain the states Virginia, Massachusetts, Virginia, and Virginia. Write a program that deletes all duplications from the file and also displays the number of states that have produced presidents.

PresStates.txt is as follows:

Virginia Massachusetts Virginia Virginia Virginia Massachusetts Tennessee New York Ohio Virginia Tennessee Lousiana New York New Hampshire Pennsylvannia Illinois Tennessee Illinois Ohio Ohio New York New York Indiana New York Ohio New York Ohio New Jersey Ohio Massachusetts California New York Missouri Kansas Massachusetts Texas California Michigan Georgia California Texas Arkansas Texas Illinois

Outcome:

In Python: The 44 lines of the file PresStates.txt contain the names

18 different states have produced presidents of the United 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!