Question: Problem Statement Create a program that prints the majority vote in a list. A majority vote is an element that occurs > N / 2

Problem Statement
Create a program that prints the majority vote in a list. A majority vote is an element that occurs > N/2 times in a list (where N is the length of the list).
Examples
["A","A","B"]"A"
["A","A","A","B","C","A"]"A"
["A","B","B","A","C","C"] None
Notes
The frequency of the majority element must be strictly greater than 1/2.
If there is no majority element, print nothing.
If the list is empty, print nothing.
Hint
You will want to use the .count() function first introduced in Runestone section 4.10.
Sample Input 1
A B C B A B G B B
Sample Output 1
B

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!