The Colorado Board of Elections has asked me to complete an audit of the tabulated results for a U.S. Congressional precinct. They have asked for the following tasks to be completed:
- 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
- Data Source: election_results.csv
- Software: Python 3.9.7, Visual Studio Code, 1.63.2
The analysis of the election shows that:
-
There were 369,711 votes cast in the election.
-
The candidates were:
- Charles Casper Stockham
- Diana DeGette
- Raymon Anthony Doane
-
The candidate results were:
- Charles Casper Stockham received 23.0% of the vote and 85,213 votes.
- Diana DeGette received 73.8% of the vote and 272,892 votes.
- Raymon Anthony Doane received 3.1% of the vote and 11,606 votes.
-
The winner of the election was:
- Candidate 2, Diana DeGette, who received 73.8% of the vote and 272,892 votes.
The election committee has asked for the following additional information:
- The voter turnout for each county
- The percentage of votes from each county out of the total count
- The county with the highest turnout.
-
The county results were:
- Arapahoe received 6.7% of the voter turnout and 24,801 votes.
- Denver received 82.8% of the voter turnout and 306,055 votes.
- Jefferson received 10.5% of the voter turnout and 38,855 votes.
-
The county with the highest turnout was:
- Denver which received 82.8% of the voter turnout and 306,055 votes.
This script completed the election audit of this Congressional precinct, but arguably could be now used for any election given a few modifications. The key to its versatility is that it was not hardcoded to include the specific county or candidate names for this given election. For a larger-scale election, this script could be modified to include information regarding voter turnout on the state or national level. It could also be modified to be a non-political election script and used for elections of all kinds.