Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix loop var in first code sample #8

Open
zstumgoren opened this issue Mar 9, 2015 · 0 comments
Open

Fix loop var in first code sample #8

zstumgoren opened this issue Mar 9, 2015 · 0 comments

Comments

@zstumgoren
Copy link
Contributor

election_results.py includes a loop that overwrites a previously declared variable. Script still works but it's a little too confusing for teaching purposes. Change needs to be made below and should be carried over to all elex dirs, branches and tutorial pages to ensure consistency:

for race_key, cand_results in results.items():
    all_votes = 0 
    cands = []
   # NOTE: below "results" var should be renamed to "row"
    for cand_key, results in cand_results.items():
        # Populate a new candidate dict using one set of county results
        cand = { 
            'first_name': results[0]['first_name'],
            'last_name': results[0]['last_name'],
            'party': results[0]['party'],
            'winner': '', 
        }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant