Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

this homework is about python, I want the answer of the (B) and (C), thank you! . U.S. Senate The file Senate113.txt contains the members

image text in transcribed
this homework is about python, I want the answer of the (B) and (C), thank you!
image text in transcribed
. U.S. Senate The file Senate113.txt contains the members of the 113th U.S. Senate- that is, the Senate prior to the November 2014 election. Each record of the file consists of three fields-name, state, and party affiliation. Some records in the file are as follows Richard Shelby, Alabama, R Bernard Sanders, Vermont,I Kristen Gillibrand, New York,D The file RetiredSen. txt contains the records from the file Senate113. txt for senators who left the Senate after the November 2014 election due to retirement, defeat, death, or resignation. Some records in the file are as follows: John Rockefeller,West Virginia,D Tom Coburn,Oklahoma,R Carl Levin, Michigan,D The file NewSen.txt contains records for the senators who were newly elected in November 2014 or who were appointed to fill the seats of senators who left after the November 2014 election. Some records in the file are as follows: Shelly Capito, West Virginia,R Steve Daines, Montana ,R Gary Peters,Michigan,D (a) Write a program that uses the three files above to create the file Senate114.txt that contains records (each consisting of three fields) for the members of the 114th Senate where the members are ordered by state. Use this file in parts (b) (c), and (d) (b) Write a program that determines the number of senators of each party affiliation (c) Write a program that determines the number of states whose two senators have (d) Write a program that asks the user to input a state, and then displays the two sena- See Fig. 5.49 the same party affiliation tors from that state. See Fig. 5.50

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

Fundamentals Of Database Management Systems

Authors: Mark L. Gillenson

2nd Edition

0470624701, 978-0470624708

More Books

Students also viewed these Databases questions