Skip to content

An introduction to Python and use it to create scripts that read, write, and store data from files or in arrays, perform mathematical operations, use decision statements, logical operations for complex comparisons, and repetition statements to run code more than once, and produce screen outputs.

Notifications You must be signed in to change notification settings

benpeyton76/Election_Anaylsis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 

Repository files navigation

Election Analysis

Overview:

An election board in Colorado has asked that an election-audit be conducted on a recent local congressional election. The following tasks include:

  1. Calculate the total number of votes,
  2. Obtain a completed list of all candidates who received votes,
  3. Caluculate total number of votes for each candidate,
  4. Calculate the percentage of votes each candidate received,
  5. And, based on popular vote, determine the winner of the election.

Results:

How many votes were cast in this congressional election?

The total number of votes in this election was 369,711.

Provide a breakdown of the number of votes and the percentage of total votes for each county in the precinct.

Denver County had the most votes out of the three counties. It came in with 82.8% of votes counted in the district. The total number of votes was 306,055. Jefferson County came in second highest with 10.5% of all votes totaling 38,855. Finally, Arapahoe County had the lowest percentage of votes in the district with 6.7% of the votes and a county total of 24,801.

Which county had the largest number of votes?

Denver County had the highest number of votes in the district.

Provide a breakdown of the number of votes and the percentage of the total votes each candidate received.

The candidate with the most votes in the election was Diana DeGette. She accounted for 73.8% of the votes with a total of 272,892 total votes. Charles Casper Stockham was the runner up with a total vote count of 85,213 which accounted for 23.0%. Raymon Anthony Doane came in last with 3.1%. He received 11,606 votes.

Which candidate won the election, what was their vote count, and what was their percentage of the total votes?

Diana DeGette won the election with 272,892 votes out of 369,711. That is 73.8% of all the votes in the district.

Screen Shot 2022-04-06 at 2 11 42 PM

Election-Audit Summary:

This script can be used in any election cycle. As shown, it can extract and calculate massive amounts of data and refine it in a very efficient way. Not only was this script used to find total votes by county and candidate, but it could also find the total votes within the district and counties. It can also calculate percentages which is extremely helpful in, not only elections themselves, but election polling as well. The script can be modified to include a larger portion of a state by expanding the county library. For example, if one wants to know how the entire northern region of Colorado voted, with the correct raw data, voting patterns can be found as a broader region as opposed to only a district. By adding variables to the names of the candidates, a commission could use this data to see trends in political party concentration. For example, by adding the party affiliation (Democrat, Republican, Independent) one could see how which part of a county, district, or state tends to vote.

About

An introduction to Python and use it to create scripts that read, write, and store data from files or in arrays, perform mathematical operations, use decision statements, logical operations for complex comparisons, and repetition statements to run code more than once, and produce screen outputs.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages