Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In python and please post a screenshot of file input (your code) next to the python shell (output) DICT HASH TABLE As you know, the

In python and please post a screenshot of file input (your code) next to the python shell (output)

DICT HASH TABLE

As you know, the president of USA is elected not by direct vote, but through a two-step voting. First elections are held in each state and determine the winner of elections in that state. Thereafter, the state election is going: in this election, every state has a certain the number of votes the number of electors from that state. In practice, all the electors from the state of voting in accordance with the results of the vote within a state.

This is how the inputs should be taken: The first line contains the number of records. After that, each entry contains the name of the candidate and the number of votes they got in one of the states. Count the total results of the elections: sum the number of votes for each candidate. Print candidates in the alphabetical order.

For example:

Input:

5

McCain 10

McCain 5

Obama 9

Obama 8

McCain 1

Output:

McCain 16

Obama 17

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

Database Concepts International Edition

Authors: David M. Kroenke

6th Edition International Edition

0133098222, 978-0133098228

More Books

Students also viewed these Databases questions