Question: Submit a Python 3 program, named vote.py, that solves the following problem: The input to your program will be a list of votes cast in

Submit a Python 3 program, named vote.py, that solves the following problem:

The input to your program will be a list of votes cast in a city election. Each line will contain one the name of a candidate. The end of input will be denoted by ***, which is not to be counted as a vote. If there is a candidate that obtained a simple or absolute majority (i.e., they received more votes than anyone else), display the name of that candidate. If no candidate obtained a simple majority, display "RUNOFF!". You may assume that there is at least one vote and that the input will be entered using the standard input.

Your program will be tested on ceclnx01 using python3.

Here are some examples of what your program should operate:

Input

Output

Franklin Roosevelt

Wendell Willkie

Franklin Roosevelt

Franklin Roosevelt

John Doe

Wendell Willkie

Franklin Roosevelt

***

Franklin Roosevelt

Homer

Tweety

Shaggy

Homer

Tweety

Shaggy

Yosemite

***

RUNOFF!

Shaggy

Shaggy

***

Shaggy

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!