Question: Exercise 5 : Block Voting Systems Part 2 - The Deciding Vote ( 5 points ) More important than determining how and when ties can

Exercise 5: Block Voting Systems Part 2- The Deciding Vote (5 points)
More important than determining how and when ties can occur in a block voting system, we can also determine how many situations arise in which a given block can cast the deciding vote.
E.g., given voting blocks [1,2,3,4], to determine the number of times the last block casts the deciding vote, we observe that:
there are a total of eight ways in which blocks 1,2, and 3 can vote:
1+2+3(for) vs.0(against)1+2(for) vs.3(against)1+3(for) vs.2(against)1(for) vs.2+3(against)2+3(for) vs.1(against)2(for) vs.1+3(against)3(for) vs.1+2(against)0(for) vs.1+2+3(against)
in cases 2-7, the last voter (with a block of 4 votes) can cause the result to swing one way or the other (or end in a tie); we therefore say that the last block has the deciding vote in 6 cases
If you repeat the analysis for blocks 1,2, and 3, you'll find that they are the deciding voters in 2,4, and 4 cases, respectively (meaning that the blocks with 2 and 3 votes are equally important!).
Complete the function deciding_votes_per_block, which will take a list of voting blocks and return a list of times that each block is the deciding vote. You may wish to define a separate helper function that computes the number of deciding votes for a given block.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!