Note that it is possible to have someone write in the same name for multiple different offices, so you do need to be careful to only count occurrences of the name present in the column representing the office you're counting votes for. You are permitted to import the csv module, but this is not required. Hints: Be careful when the request is for the last column in the file - if you're splitting by comma, then that column will contain the '\n' character, and this shouldn't be included in the candidate names, or in the name of the office. You can assume for the sake of simplicity that no candidate or office will contain a comma in the name. Disclaimer: The data in the CSV files was randomly generated from all names available on the ballot for a given district according to https://myballotmn.sos.state.mn.us/ (along with a few fictional characters to simulate write-ins). Don't take any given candidate randomly getting more "votes" than another as an endorsement. Examples (assumes that you have the sample files from hw09files.zip downloaded to the same directory that you're running Python in): >>> count_votes('district_0z.csv', 'County Sheriff') {'Shallan Davar': 1, 'Liz Lemon': 3, 'Ron Swanson': 1} >>> count_votes('district_4b.csv', 'Mayor') {'Shelly Carlson': 7, 'Donna Meagle': 2, 'Kevin Nese Shores': 5} >>> count_votes('district_60b.csv', 'County Commissioner District 4') {'Angela Conley': 50, 'Monkey D. Luffy': 1, 'Jobu Tupaki': 2, 'Leslie Knope': 1}
Note that it is possible to have someone write in the same name for multiple different offices, so you do need to be careful to only count occurrences of the name present in the column representing the office you're counting votes for. You are permitted to import the csv module, but this is not required. Hints: Be careful when the request is for the last column in the file - if you're splitting by comma, then that column will contain the '\n' character, and this shouldn't be included in the candidate names, or in the name of the office. You can assume for the sake of simplicity that no candidate or office will contain a comma in the name. Disclaimer: The data in the CSV files was randomly generated from all names available on the ballot for a given district according to https://myballotmn.sos.state.mn.us/ (along with a few fictional characters to simulate write-ins). Don't take any given candidate randomly getting more "votes" than another as an endorsement. Examples (assumes that you have the sample files from hw09files.zip downloaded to the same directory that you're running Python in): >>> count_votes('district_0z.csv', 'County Sheriff') {'Shallan Davar': 1, 'Liz Lemon': 3, 'Ron Swanson': 1} >>> count_votes('district_4b.csv', 'Mayor') {'Shelly Carlson': 7, 'Donna Meagle': 2, 'Kevin Nese Shores': 5} >>> count_votes('district_60b.csv', 'County Commissioner District 4') {'Angela Conley': 50, 'Monkey D. Luffy': 1, 'Jobu Tupaki': 2, 'Leslie Knope': 1}
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
In python
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 5 steps with 3 images
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY