Question: I need help writing a python program for the following problem. The program cannot be written with function but needs to utilize loops. The Democrat

I need help writing a python program for the following problem. The program cannot be written with function but needs to utilize loops.

The Democrat and Republican candidates for the presidential election have 5 debates. After each debates a sample of registered voters are polled to see who has won that debate. Write a Python program to do the following. In each of the 5 debates, ask the user to enter the percentage of voters who think the Democrat candidate has won and the percentage of voters who think the Republican candidate has won. If the difference is within 3 percent, the debate is statistically tied. If one candidate beats the other person by more than 3 percent, that candidate is the winner of that debate. Display the winner of each debate or report a tie. After all 5 debates, display the number of debates each candidate has won. Compare these numbers and report which candidate has won more debates, or they have won the same number of debates.

CASES FOR TESTING:

What percentage of people think Democrat's candidate has won? 42 What percentage of people think Republican's candidate has won? 45 It is statistically a tie Debate 2 : What percentage of people think Democrat's candidate has won? 44 What percentage of people think Republican's candidate has won? 39 Democrat's candidate has won this debate Debate 3 : What percentage of people think Democrat's candidate has won? 40 What percentage of people think Republican's candidate has won? 45 Republican's candidate has won this debate

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 Databases Questions!