Nov 13: PA2 Hints, PA3, Quiz5
Learning Objectives
After today's class, you should be able to:
Announcements¶
- Due Thursday: PA2 Part C
- Due Friday: PA2 Reflection
- Due Tuesday: Ch 12 (last chapter!)
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()
- easiest function on PA2 – call
- 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
- Read last.fm data from json files
- Build playlists and find new songs
- PA 3 specification and sample data
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