Created
March 7, 2015 22:23
-
-
Save miroli/f00d501232436fd4e691 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def generate_results(results_list): | |
""" | |
Generate an iterator of Result objects from a list of dictionary | |
containing result attributes | |
Args: | |
results_list: An iterable of dictionaries representing election | |
results. Each dictionary should have at least the following | |
keys: `candidate_name`, `candidate_id`, and `total_votes`. | |
Returns: | |
An iterator over Result objects created from the attributes in | |
results_list | |
""" | |
# TODO: Implement this generator | |
for result in results_list: | |
yield Result(result) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment