Popular Vote
This commit is contained in:
15
popularvote.py
Normal file
15
popularvote.py
Normal file
@@ -0,0 +1,15 @@
|
||||
t = int(input())
|
||||
|
||||
for _ in range(t):
|
||||
votes = []
|
||||
|
||||
n = int(input())
|
||||
for _ in range(n):
|
||||
votes.append(int(input()))
|
||||
|
||||
winner = max(votes)
|
||||
if votes.count(winner) > 1:
|
||||
print('no winner')
|
||||
else:
|
||||
majorminor = 'major' if winner > sum(votes)/2 else 'minor'
|
||||
print(f'{majorminor}ity winner {votes.index(winner)+1}')
|
||||
Reference in New Issue
Block a user