Question

Votes Needed to Win [5 points] 3.1 Many voting systems use the Droop Quota to determine if a candidate has enough votes to wi

Need some help with this question! Each dictionary is essentially one votes so first example total votes is 3. Please add comments to explain. Language is python

0 0
Add a comment Improve this question Transcribed image text
Answer #1

import math
def votes_needed_to_win(ballot,n):#start of function with two parameters ballot and number of winners
#math.floor rounds down the result
#len(ballot) gives the number of votes
#here 'n' is the number of winners
print(math.floor(len(ballot)/(n+1))+1)

election.py - C:/Users/sai kumar/AppData/Local/Programs/Python/Python37/election.py (3.7.... - Х File Edit Format Run Options

output:

>>> elect([{a:3, b:5},{a:2, b:4},{a:3, b:5}],1) >>> RESTART: C:/Users/sai kumar/AppData/Local/Programs/Python/Pyt

Add a comment
Know the answer?
Add Answer to:
Need some help with this question! Each dictionary is essentially one votes so first example total...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • dont need help on the first two pictures, only need help underatanding these: number 1,2,3,4,5,6. please help:/...

    dont need help on the first two pictures, only need help underatanding these: number 1,2,3,4,5,6. please help:/ O Yes. The Condorcet winner is never the majority winner Yes. The Condorcet winner is not required to receive over 50% of the possible vote. O No. The Condorcet winner is automatically the majority winner. No. The Condorcet winner always receives over 50% of the possible vote. 7. Using this preference schedule, which candidate is the Condorcet winner? (1 point) number of votes...

  • (2 points) 5 4 4 0 6 Dominic Annie Florence Dominic Florence Annie Annie Dominic Florence...

    (2 points) 5 4 4 0 6 Dominic Annie Florence Dominic Florence Annie Annie Dominic Florence Annie Florence Dominic Florence Dominic Annie Florence Annie Dominic Construct an example with 19 voters in which: 1) Dominic would win with the Plurality method 2) Annie would win with the Borda count method and be a Condorcet candidate (and win with Pairwise Comparison as well), 3) Florence would win if Plurality with Elimination is used 4) Also, Annie has a total of two...

  • (2 bookmarks) In JAVA You have been asked to write a program that can manage candidates...

    (2 bookmarks) In JAVA You have been asked to write a program that can manage candidates for an upcoming election. This program needs to allow the user to enter candidates and then record votes as they come in and then calculate results and determine the winner. This program will have three classes: Candidate, Results and ElectionApp Candidate Class: This class records the information for each candidate that is running for office. Instance variables: first name last name office they are...

  • Hi I need some help in C programing class and I doing one of the exercise...

    Hi I need some help in C programing class and I doing one of the exercise so that I can get better at coding. Suppose you are asked to design a software that helps an elementary school student learn multiplication and division of one-digit integer numbers. The software allows the student to select the arithmetic operation she or he wishes to study. The student chooses from a menu one of two arithmetic operations: 1) Multiplication and 2) Division (quotient). Based...

  • In java language here is my code so far! i only need help with the extra...

    In java language here is my code so far! i only need help with the extra credit part For this project, you will create a Rock, Paper, Scissors game. Write a GUI program that allows a user to play Rock, Paper, Scissors against the computer. If you’re not familiar with Rock, Paper, Scissors, check out the Wikipedia page: http://en.wikipedia.org/wiki/Rock-paper-scissors This is how the program works: The user clicks a button to make their move (rock, paper, or scissors). The program...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT