Write a function that returns a list of unique candidates who got more than a specified percentage (as a decimal) of total votes cast

Write a function that returns a list of unique candidates who got more than a specified percentage (as a decimal) of total votes cast. If the percentage is not between 0 and 1.0 (inclusive), return an empty list. Hint: Find the total number of votes, then the number of votes for each candidate. Example: >>> print(get_top_candidates(read_txt(“us-2016-primary-results.txt”), 0.15)) [‘Hillary Clinton’, ‘Donald Trump’, ‘Marco Rubio’, ‘Ted Cruz’]”

You may also like...