A Colorado Board of Elections employee named Tom has given the following tasks to complete the election audit of a recent local congressional election.
- Calculate the total number of votes cast.
- Get a complete list of candidates who received votes.
- Calculate the total number of votes each candidate received.
- Calculate the percentage of votes each candidate won.
- Determine the winner of the election based on popular vote.
- Determine the total number and percentage of votes of each county.
- Determine which county had the largest voter turnout.
- Data Source: election_results.csv
- Software: Python 3.7.6, Visual Studio Code 1.40.2
The analysis of the election shows:
Total Votes: 369,711
Charles Casper Stockham: 23.0% (85,213)
Diana DeGette: 73.8% (272,892)
Raymon Anthony Doane: 3.1% (11,606)
Winner: Diana DeGette
Winning Vote Count: 272,892
Winning Percentage: 73.8%
The challenge required outputting the vote total and vote percentage for all counties involved in the election.
This script can be used in any election where multiple counties and multiple candidates are involved to track number of votes and the percentage of votes received for each candidate and from each county. In this report three candidates and three counties were counted, but more counties and candidates can be counted if needed. This script can be modified to track other indices such as age group, race, sex, etc.
County Votes:
Jefferson: 10.5% (38,855)
Denver: 82.8% (306,055)
Arapahoe: 6.7% (24,801)
Largest County Turnout: Denver