The total number of votes cast A complete list of candidates who received votes The percentage of
Question:
The total number of votes cast
A complete list of candidates who received votes
The percentage of votes each candidate won
The total number of votes each candidate won
The winner of the election based on popular vote
The result like this
Election Results ------------------------- Total Votes: 369711 ------------------------- Charles Casper Stockham: 23.049% (85213) Diana DeGette: 73.812% (272892) Raymon Anthony Doane: 3.139% (11606) ------------------------- Winner: Diana DeGette -------------------------
this is my code
import os
import csv
#set the path to the csv file
csvpath = os.path.join('..','Resources','election_data.csv')
#open the csv file and read through the rows
with open(csvpath) as csvfile:
reader = csv.reader(csvfile, delimiter=',')
#count for total number of votes cast
#skip the header row
header = next(reader)
#variables
count = 0
percentage_votes = 0
total_number = 0
candidate = ""
winner = ""
#candidates who received votes
candidate_received_votes = [0,0,0]
#candidates list
candidate_list = ["Charles Casper Stockham","Diana DeGette","Raymon Anthony Doane"]
# loop through the rows in the csv file
help me finish the for loop and while loop
Microeconomics An Intuitive Approach with Calculus
ISBN: 978-0538453257
1st edition
Authors: Thomas Nechyba