Question

In: Computer Science

program to get votes for candidate a #dem #rep #lib #ind= total votes candidate b dem#...

program to get votes for candidate a #dem #rep #lib #ind= total votes
candidate b dem# rep# lib# ind# = total votes
print a or b winner in python

i am writing my own program trying to input numbers for democrat republican libiraterians and indipendents voters for each candidate. i need to be able to change the percentage of voters and thus the totals for each group at the end of the program print candidate a or b won or the vote is tied

Solutions

Expert Solution

code:
print("Details for candidate a")
adem =int(input("Enter democratic members for a : "))
arep =int(input("Enter republican members for a : "))
alib =int(input("Enter libiraterians members for a : "))
aind =int(input("Enter independent members for a : "))
print("Details for candidate b")
bdem =int(input("Enter democratic members for b : "))
brep =int(input("Enter republican members for b : "))
blib =int(input("Enter libiraterians members for b : "))
bind =int(input("Enter independent members for b : "))
a=(adem+arep+alib+aind)
b=(bdem+brep+blib+bind)
if(a>b):
print("a is the winner as he got high number of votes")
elif(a<b):
print("b is the winner as he got high number of votes")
elif(a==b):
print("Both got same number of votes so tied")
  


Related Solutions

C++ Write a program that reads candidate names and numbers of votes in from a file....
C++ Write a program that reads candidate names and numbers of votes in from a file. You may assume that each candidate has a single word first name and a single word last name (although you do not have to make this assumption). Your program should read the candidates and the number of votes received into one or more dynamically allocated arrays. In order to allocate the arrays you will need to know the number of records in the file....
Candidate A Candidate B Total No Degree 60 17 77 College Degree 48 75 123 Total...
Candidate A Candidate B Total No Degree 60 17 77 College Degree 48 75 123 Total 108 92 200 1. Two hundred potential voters were randomly sampled and asked their voting intentions. All participants could choose from 2 potential candidates and were also asked about their education. The results are presented below. 108 92 200 Test whether there is an association between education and voter preference α= 0.05.
Rep Dem Ind total 20's 42 67 19 30's 48 59 24 40's 45 45 20...
Rep Dem Ind total 20's 42 67 19 30's 48 59 24 40's 45 45 20 50's 52 50 18 60's+ 65 49 18 total Above is a table listing a samples voting demographic by age. is there evidence of a relationship between any of the variables? i cant tell yes no
An academic department has just completed voting by secret ballot for a department head. The ballot box contains four slips with votes for candidate A and three slips with votes for candidate B. Suppose these slips are removed from the box one by one.
An academic department has just completed voting by secret ballot for a department head. The ballot box contains four slips with votes for candidate A and three slips with votes for candidate B. Suppose these slips are removed from the box one by one.(a) List all possible outcomes.(b) Suppose a running tally is kept as slips are removed. For what outcomes does Aremain ahead of B throughout the tally?
In a pre-election poll, a candidate for district attorney receives 204 of 400 votes. Assuming that...
In a pre-election poll, a candidate for district attorney receives 204 of 400 votes. Assuming that the people polled represent a random sample of the voting population, test the claim that the majority of voters support the candidate. Use a 0.05 significanc3e level to conduct a hypothesis test using the four step procedure. H0:p=0.5 Ha:p>0.05 Find the test statistic. z=? p=? is it right, left, or two tailed?
In a pre election poll, a candidate for district attorney receives 380 of 750 votes. Assuming...
In a pre election poll, a candidate for district attorney receives 380 of 750 votes. Assuming that the people polled represent a random sample of the voting population, test the claim that a majority of voters support the candidate. Use a 0.05 significance level to conduct a hypothesis test using the four-step procedure.
In a C language program CODE BLOCKS !!!!!!!! Program that stores the number of votes obtained...
In a C language program CODE BLOCKS !!!!!!!! Program that stores the number of votes obtained by 3 amounts in five different zones. Is required: + Request the total of votes by zone of each candidate, the values must be entered on the keyboard and validate that it does not accept negative numbers + Menu that requests the operation to be performed, in case of entering an invalid data send an error message and request the operation again + Option...
Develop and test an Intel 8086 assembly program by emu8086 amd dont use any extirnall lib...
Develop and test an Intel 8086 assembly program by emu8086 amd dont use any extirnall lib , that reads two decimal numbers x and y. Your program should display the result of their: 1) Addition: x+y 2) Subtraction: x-y 3) Multiplication: x*y 4) Division: x / y Notes:  x and y are two-digit decimal numbers (i.e. 0-99).  The program should display an error message if the value of y is zero, in the case of division.  You...
What factors influence the ability for a candidate to get elected? Explain the advantages and disadvantages...
What factors influence the ability for a candidate to get elected? Explain the advantages and disadvantages to a winner-take-all system. Do you think our system of government should be reformed to a proportional system for electing the president? What would the consequences of such a change be?
1. What factors influence the ability for a candidate to get elected, and what role do...
1. What factors influence the ability for a candidate to get elected, and what role do political parties play in elections? 2. How does a winner-take-all system affect elections and political parties? 3. How do elections and parties affect the discussion on the national debt? 4. How do you propose we deal with the debt?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT