Question: PYTHON 3.6 provide .py files Write a function vote () that takes as a parameter a list of names of candidates up for election and
PYTHON 3.6
provide .py files
Write a function vote() that takes as a parameter a list of names of candidates up for election and repeatedly asks the user to enter a name of one of the candidates. When the user enters the empty string, the function prints for every name on the ballot the number of votes that the candidate received. The candidates and vote totals can be printed in any order as long as all of the information is presented. If the user types a name that cannot be found in the list of candidates, the vote is recorded for the 'Unknown' candidate. Capitalization shouldn't matter so that a candidate's name appearing in all uppercase, all lowercase, or in mixed case should record a vote for the associated person. When the user types a blank name, then the function should stop and report the vote totals. The vote totals should be reported using correct grammar, meaning using was/were and the singular or plural of vote appropriately. The following shows a sample run of the vote() function. Please note that your function must work on all valid examples, not just the ones provided below:

Python 3.4.1 Shell File Edit Shell Debug Options Windows Help vote Durbin "Oberweiss", Hansen Enter a vote Durbin Enter a vote Hansen Enter a vote Ober WEISS Enter a vote DURBIN Enter a vote Settle Enter a vote durbin Enter a vote oberweiss Enter a vote There were 2 votes for Oberweiss. There was 1 vote for Unknown. There were 3 votes for Durbin. There was 1 vote for Hansen. vote (C Quinn Rauner Grimm Enter a vote QUINN Enter a vote Rauner Enter a vote RAUNER Enter a vote rauner Enter a vote grimm Enter a vote Quinn Enter a vote quinn Enter a vote rauner Enter a vote settle Enter a vote There were 3 votes for Quinn. There was 1 vote for Unknown. There were 4 votes for Rauner. There was 1 vote for Grimm. Ln: 89 Col: 4
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
