Skip to content

Nov 13: PA2 Hints, PA3, Quiz5

Learning Objectives

After today's class, you should be able to:

  • Summarize the algorithms of the "Part C" functions of PA 2.
  • Describe the requirements and programming topics of PA 3.

Announcements

PA2 Hints & Tips

  • vote_file_processor_c.py
    • read_first_choice_per_state
      • build dictionary of {state: first choice count}
    • read_complete_ballot
      • build dictionary of {voter: list of candidates}
      • Note this translates file format to irv format
    • read_electoral_college
      • easiest function on PA2 – call json.load()
  • election_c.py
    • electoral_votes
      • find the winning candidate of each state using count_popular
      • calculate votes per candidate using the allocation per state
      • use count_majority to find the overall winner
    • irv – 3 rounds:
      • count how many 1st choice votes each candidate has
      • use count_majority and return if a winner is found
      • otherwise remove candidate with the fewest votes

PA3 Introduction

  • Main Idea
Submission Points Due Notes
Part A. Tests 10 points Mon 11/18 write assert statements
Part B. Code 50 points Thu 11/21 implement 9 functions
Part C. Code 40 points Tue 12/03 recursion + open ended

Quiz 5

  • 1st sheet: written potion
  • 2nd sheet: coding potion
  • 3rd sheet: reference sheet
  • Turn off monitor during quiz