//
you're reading...
Uncategorized

Voting to Determine the Best Senior Design Project

votes={
"Jamie":(33,34,3),
"Alexia": (33,34,3),
"Cameron":(34,35,24),
"Jeremiah L": (18,3,16),
"Kyle G": (35,3,10),
"Ben":(34,35,10),
"Kyle T": (11,27,7),
"Caleb A": (17,18,3),
"Dom": (11,27,33),
"Kyle R": (31,11,3),
"Joseph K":(18, 17, 16),
"Thadeus R":(2,35,17),
"Rachel K":(3,18,35),
"Heather":(35,18,17),
"Seth D": (17, 35, 4),
"Joey": (18, 2, 17),
"Jeremiah G":(2, 18,3),
"Alexandria":(31,35,11),
"Christopher":(18,35,17),
"Kristin":(35,18,34),
"Frazier":(18,2,3),
"Katelyn":(35,31,3),
"Jennifer":(34,30,28),
"Nick":(34,35,3),
"Chris K":(3,34,35),
"John":(28,1,33),
"Matthew":(3,33,18),
"Elliot":(35, 3, 28),
"Dylan":(35,33,3),
"Patrick":(35, 4, 34),
"Sree":(35,4,34)}}

print "Number of Voters", len(votes)

#Compute a score for each project
#Start by counting vote frequency
freq_scores = {}
for tup in votes.values():
    for v in tup:
        if v in freq_scores:
           freq_scores[v]+=1
        else: freq_scores[v]=1

# Next compute Weighted Scoring - use 5,3,1 points for #1, #2, #3, respectively
# Initialize a dict with project number keys and O for values

w531_scores= {key:0 for key in range(40)} # or equiv dict(zip(range(40),40*[0]))

for tup in votes.values():
    a,b,c = tup
    w531_scores[a]+=5
    w531_scores[b]+=3
    w531_scores[c]+=1

#Find the Winners by finding project with max scores
scores=freq_scores
maxval=0
for p in scores:
      if scores[p] > maxval:
         maxval = scores[p]
         freq_winner = p

for k in scores:
    if (scores[k]==maxval):
        print k, " has most number of unweighted votes", maxval

scores=w531_scores
maxval=0
for p in scores:
      if scores[p] > maxval:
         maxval = scores[p]
         w531_winner = p

for k in scores:
    if scores[k]==maxval:
        print k, " has most number of Weighted votes", maxval

# Paired Compairsons - look at voters who picked both winners
for voter in votes:
    tup=votes[voter]
    if freq_winner in tup and w531_winner in tup:
        print voter, votes[voter]

Advertisement

Discussion

No comments yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: