Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python 3.7 problem.. Use the vote excel files along with the test case file for this problem, both can be download through the shared google

Python 3.7 problem..

Use the vote excel files along with the test case file for this problem, both can be download through the shared google drive, only use open() function to access the csv file.

https://drive.google.com/drive/folders/1OqrHxY42Cka9_H9pfA9VLQOkIuqoSQKN?usp=sharing

image text in transcribedimage text in transcribed

Candidate: we will use the following representation for a candidate inside our program: a tuple containing these values in this order. Note that name and party are string abbreviations and popular votes and electoral votes are integers. candidate (name, party, popular votes, electoral_votes) Database1: a "database" of votes can store all candidates' votes for each State. Obviously, a candidate's name may get reused in different States, but never in the same State. Not all candidate names appear in every State. Our database must be a dictionary whose keys are States, and whose values are lists of candidate values, Only candidates with positive number of popular_votes may be present in a State. Empty lists are not allowed as values. Candidates in the same State must be stored alphabetically by their abbreviated name (hint: use insert instead of append when adding items to the list because you can't use sorting functions) votes_db- 'AL: CJohnson', 'IND', 44467, 0), (Stein', 'IND', 9391, 0)] 'AK: [(Trump', 'REP, 163387, 9)1 VA: [('Clinton', 'DEM', 1981473, 13)1 Database2: a "database" of abbreviations will store all abbreviations as a dictionary whose keys are the abbreviated strings and whose values are the equivalent full strings, like in the following sample abbr_db-t AL': 'Alabama' AK': 'Alaska', DEM': 'Democratic', 'REP: 'Republican', Trump: 'Donald Trump

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

Data Management Databases And Organizations

Authors: Richard T. Watson

3rd Edition

0471418455, 978-0471418450

More Books

Students also viewed these Databases questions