This is not a graded assignment, though we still expect you to submit it before class on Wednesday. You are welcome to collaborate with others on this. We are requiring it in order to make sure everyone is ready to go with Python for class on Wednesday. Handin as usual through the Google form
Name your file votes.py.
Practice with a simplified version of our voting setup. Be sure to also practice writing tests.
Write a function name-matches that takes a vote (string) and a name and returns a boolean indicating whether the vote is for the given name, regardless of how the vote has been capitalized. You can lowercase a string s in Python by writing s.lower() (where s gets replaced by the string you want to lowercase. As in Pyret, you have Boolean operators and, or, and not.
Write a function any_votes_for that takes a name and a list of votes and returns a boolean indicating whether any votes were for the given name.
Write a function count_votes_for that takes a name and a list of votes, and returns the number of votes that match the given name.
Write a function got_more_votes that takes two names and a list of votes, and returns the name that got more votes (assume there won’t be ties).
Write a function record_vote that takes a list of votes and a new vote (string) and adds the vote to the list.
Write a function percentage_votes that takes a name and a list of votes and returns the percentage of votes that match the given name.
Write a test_votes function to test your vote functions. In particular, think about how to test record_vote. Remember that you need to put
import testlight
in your file to get the testing function from class.