Menu

[Solved]-Python File Senate113sortedtxt Contains List 100 Us Senators Made 113th Senate Sorted Alph Q37250827

In Python

The file Senate113_sorted.txt contains a list of the 100 USSenators that made up the 113th Senate, sorted in alphabeticalorder by Senator last name. Write a function named different_partythat accepts one argument, a file name, and returns a list of USstates whose Senators come from 2 different political parties (asindicated by D, R, or I).

Here’s a few rows from the file

Lamar Alexander,Tennessee,R
Kelly Ayotte,New Hampshire,R
Tammy Baldwin,Wisconsin,D
John Barrasso,Wyoming,R
Max Baucus,Montana,D
Mark Begich,Alaska,D
Michael Bennet,Colorado,D
Richard Blumenthal,Connecticut,D
Roy Blunt,Missouri,R
John Boozman,Arkansas,R
Barbara Boxer,California,D
Sherrod Brown,Ohio,D
Richard Burr,North Carolina,R
Maria Cantwell,Washington,D
Benjamin Cardin,Maryland,D
Thomas Carper,Delaware,D
Robert Casey,Pennsylvania,D
Saxby Chambliss,Georgia,R
Dan Coats,Indiana,R
Tom Coburn,Oklahoma,R

In [1]: different_party(Senate113_sorted.txt) out[1]: [ New Hampshire, Wisconsin, Alaska, Missouri, Arkansas , Ohio No

In [1]: different_party(‘Senate113_sorted.txt’) out[1]: [ ‘New Hampshire’, Wisconsin’, Alaska’, Missouri, Arkansas , Ohio’ North Carolina’, Pennsylvania’, Indiana, Maine Illinois’, Iowa North Dakota’, Nevada’, South Dakota’, Louisiana’, Vermont’ Florida Show transcribed image text In [1]: different_party(‘Senate113_sorted.txt’) out[1]: [ ‘New Hampshire’, Wisconsin’, Alaska’, Missouri, Arkansas , Ohio’ North Carolina’, Pennsylvania’, Indiana, Maine Illinois’, Iowa North Dakota’, Nevada’, South Dakota’, Louisiana’, Vermont’ Florida

Expert Answer


Answer to In Python The file Senate113_sorted.txt contains a list of the 100 US Senators that made up the 113th Senate, sorted in … . . .

OR


Leave a Reply

Your email address will not be published. Required fields are marked *