2020-21 CAIE 0984 Pre-release
2020-21 CAIE 0984 Pre-release
If you are sitting the exam this year you should already have been working on this in preparation for section A of paper 2. Your school will have given you the pre-release document for your region. It is honestly important for you to work on this yourself and use it to improve your problem solving and programming skills.
There are different versions but this article focuses upon the one about recording the votes cast in student council elections.
Key Points:
- Storing unique voter ID and whether or not each student has voted
- CAIE is not expecting multi-dimensional arrays (lists in Python)
- You can deal with this by using multiple lists and using the index for each element of the array as a link
aList = ['Voter1', 'Voter2', 'Voter3'...]
bList = ['Voted', 'Voted', 'Abstained', ...]
So index position aList[1] points to student ‘Voter2‘ and the same index bList[1] = ‘Voted‘ which indicates that student ‘Name2’ has voted. Similarly index position 2 in both lists shows that student ‘Voter3’ abstained (did not vote).
- Allow each student to enter their VoterID and before they vote check if they have voted before
vID = input('Enter your voter id') # which data type are you using?
# Loop through list of VoterIDs until we find the voterID or have reached the end
# Use the index to check in the other list to see if that person has voted
- Need to hold a vote count for each candidate so we’ll need a suitable data structure