INF1002F - Python Project
INF1002F - Python Project
Submission Instructions:
• Write a python program and submit your .py file Team_xx_Python_Project.py (where
Team_xx is your Group number).
1. Adding a Candidate
2. Viewing Candidates
3. Casting a Vote
4. Viewing Polls
There are some features that are out of scope for this project [NOT TO BE DONE]:
• Candidate Pictures, Portfolios, Attachments, Posters
• Users have to vote (there is no abstaining)
Adding a Candidate
This feature allows for the addition of a new candidate.
Viewing Candidates
This feature lists the current candidates and their relevant information.
Casting a Vote
This feature involves a few steps.
First a user is requested to input their South African ID. The platform performs a check to see if it is a
valid South African ID. A valid South African ID should have 13-digit number and the first 6 digits
need to be a valid birthdate. Below is an illustration depicting how a South African ID is decoded.
Note, the 3 other decoding are out of scope.
If a user is a valid South African ID holder, the platform has to check if the user has already voted. If
the user has not yet voted, the platform provides the user with a list to choose the candidate and a
vote is casted. Each vote counts as 1.
Viewing Polls
At any given time, the live results of the election may be viewed. The poll shows number of people
voted so far and the percentage of the population that has voted. For each candidate it shows the
number of votes and the percentage votes from the votes casted so far.
System Overview
Your system will need to always be running unless the user decides to exit the system. You may use a
USSD style of menu drop-down for the user to select from ( i.e. a menu similar to the one you see
when you check for your airtime on your phone).
Whenever a certain action is performed by the system, give feedback to the user. If a vote is casted,
let the user know the vote has been successfully casted.
Your system should also be able to handle incorrect input without the system crashing.
Below are screenshots to assist you in building your system. Note: You are free to design your own
When your system starts, you display the menu. Your menu should allow the user to exit the
program too.
For any other menu item, for now, you may indicate it is still not available and return to the main
menu as illustrated below.
Rubric: 40 marks
5 3 2 1 0
Menu Program runs Program runs Program runs Program runs -
until user makes until user makes but does not once and needs
an input to exit. an input to exit. allow for user to to be re-run
Program Program crashes exit. again to get to
continues when an Program crashes the menu
running when incorrect choice when incorrect
incorrect input is is given. choice is given
given.
Menu item Program runs, Program runs, Program runs, Program runs -
user is able to user is able to user is able to but crashes
select an option, select an option, select an option,
option is shown, option is shown, option is shown,
program shows program ends program gets
main menu stuck/crashes
again
Add Adding Adding Adding Program crashes -
Candidate candidate does candidate does candidate does when adding
not crash the not crash the not crash the candidate
program. program. program.
Accounts for Accounts for Incorrect inputs
incorrect inputs some incorrect (spaces in
(spaces in inputs (spaces in inputs, no value
inputs, no value inputs, no value etc.) crashes the
etc.). etc.) crashes the program.
program.
View All Candidates Some candidates Some candidates Program crashes -
Candidates are shown with are shown with shown with when viewing
their information their some candidates.
[Id, Name, Party information/All information
& Motto] candidates
shown with
some of their
information
View Polls 1 mark for each 1 mark for each 1 mark for each 1 mark for each -
(if it crashes of the following of the following of the following of the following
0). shown: (All shown: (All shown: (All shown: (All
figures are 0 for figures are 0 for figures are 0 for figures are 0 for
Del 1) Del 1) Del 1) Del 1)
1. Total Votes 1. Total Votes 1. Total Votes 1. Total Votes
2. Percentage of 2. Percentage of 2. Percentage of 2. Percentage of
Population Population Population Population
Voted Voted Voted Voted
3. List of 3. List of 3. List of 3. List of
Candidates [ID & Candidates [ID & Candidates [ID & Candidates [ID &
Name] Name] Name] Name]
4. Number of 4. Number of 4. Number of 4. Number of
Votes/Total Votes/Total Votes/Total Votes/Total
Votes Casted Votes Casted Votes Casted Votes Casted
5. Percentage of 5. Percentage of 5. Percentage of 5. Percentage of
Votes received Votes received Votes received Votes received
from Votes from Votes from Votes from Votes
Casted Casted Casted Casted
Formatting 1 mark for each 1 mark for each 1 mark for each 1 mark for each -
Polls of the following of the following of the following of the following
done correctly: done correctly: done correctly: done correctly:
1. Total Votes 1. Total Votes 1. Total Votes 1. Total Votes
shown as total shown as total shown as total shown as total
votes/population votes/population votes/population votes/population
2. Percentage of 2. Percentage of 2. Percentage of 2. Percentage of
Population Population Population Population
Voted shown as Voted shown as Voted shown as Voted shown as
% 2dp % 2dp % 2dp % 2dp
3. Candidates – 3. Candidates – 3. Candidates – 3. Candidates –
information in information in information in information in
the same row the same row the same row the same row
4. Number of 4. Number of 4. Number of 4. Number of
votes shown as votes shown as votes shown as votes shown as
number of votes number of votes number of votes number of votes
received/the received/the received/the received/the
votes casted votes casted votes casted votes casted
5. Percentage of 5. Percentage of 5. Percentage of 5. Percentage of
Votes received Votes received Votes received Votes received
as % 2dp as % 2dp as % 2dp as % 2dp
User For every In most In some In very few -
Feedback operation in the operations in the operations in the operations in the
platform, the platform, the platform, the platform, the
user is provided user is provided user is provided user is provided
feedback. feedback. feedback. feedback.
Coding Followed coding Followed coding Followed coding Followed coding -
Practices principles as principles as in principles as in principles in very
much as most cases as some cases. few cases.
possible. possible.
Below are screenshots to assist you in building your system. Note: You are free to design your own
Casting a vote:
Voting twice:
View Polls:
Rubric: 60 marks
5 3 2 1 0
Cast Vote – ID Valid ID Check: Valid ID Check: Valid ID Check: Valid ID Check: -
9202204720082 9202204720082 9202204720082 9202204720082
Perform Checks Perform Checks Perform Checks Perform Checks
to Validate ID to Validate ID to Validate ID to Validate ID
-1 mark for -1 mark for -1 mark for -1 mark for
each incorrect each incorrect each incorrect each incorrect
validation: validation: validation: validation:
1. A letter, 1. A letter, 1. A letter, 1. A letter,
number, empty number, empty number, empty number, empty
string or space string or space string or space string or space
2. A number 2. A number 2. A number 2. A number
3. 13 characters 3. 13 characters 3. 13 characters 3. 13 characters
letters & letters & letters & letters &
numbers numbers numbers numbers
4. 13 characters 4. 13 characters 4. 13 characters 4. 13 characters
numbers numbers numbers numbers
5. Birthdate is 5. Birthdate is 5. Birthdate is 5. Birthdate is
incorrect in ID incorrect in ID incorrect in ID incorrect in ID
eg. eg. eg. eg.
9222204720082 9222204720082 9222204720082 9222204720082
Cast Vote - An ID that has An ID that has An ID that has An ID that has -
Duplicate voted can’t vote voted can’t vote voted can’t vote voted can vote
again. again. again. again.
Check logic in On checking On checking Points for
code to ensure logic in code, logic in code, attempting
no scenarios there is a there is a good duplicate check.
allow double possibility for chance for
voting. votes to be votes to be
casted more casted more
than once than once
(minor flaw) (major flaw)
Cast Vote – When a vote is When a vote is When a vote is When a vote is -
Logic cast, the cast another cast, the cast, no votes
candidate candidate gets candidate are increased
selected has 1 the vote. selected has but the system
vote increased more than 1 does not crash.
and no other vote increased. (points for
candidate gets attempting to
a vote. do logic)
Cast Vote – System does System does System does System does
Error Handling not crash when not crash when not crash when crash when
incorrect input incorrect input incorrect input incorrect input
is entered eg. is entered eg. is entered eg. is entered eg.
Letter, space, Letter, space, Letter, space, Letter, space,
candidate candidate candidate candidate
number that number that number that number that
does not exist, does not exist, does not exist, does not exist,
empty string empty string empty string empty string
etc. etc. etc. etc.
System asks for System goes Stuck in an
user to enter a back to main infinite loop.
valid candidate menu.
number.
View Polls – 1 mark for each 1 mark for each 1 mark for each 1 mark for each -
Population correctly correctly correctly correctly
(after votes are working item: working item: working item: working item:
cast) 1. Total Votes 1. Total Votes 1. Total Votes 1. Total Votes
Shown Shown Shown Shown
2. Total 2. Total 2. Total 2. Total
Population Population Population Population
Shown Shown Shown Shown
3. Total 3. Total 3. Total 3. Total
Votes/Total Votes/Total Votes/Total Votes/Total
Population Population Population Population
Shown Shown Shown Shown
4. Percentage of 4. Percentage of 4. Percentage of 4. Percentage of
Votes done so Votes done so Votes done so Votes done so
far shown far shown far shown far shown
5. Formatted as 5. Formatted as 5. Formatted as 5. Formatted as
% 2dp % 2dp % 2dp % 2dp
View Polls – 1 mark for each 1 mark for each 1 mark for each 1 mark for each -
Candidates correctly correctly correctly correctly
(after votes are working item: working item: working item: working item:
cast) 1. All 1. All 1. All 1. All
Candidates are Candidates are Candidates are Candidates are
listed, and listed, and listed, and listed, and
information is information is information is information is
shown shown shown shown
2. Each 2. Each 2. Each 2. Each
candidates total candidates total candidates total candidates total
votes are votes are votes are votes are
shown shown shown shown
3. Each 3. Each 3. Each 3. Each
candidates total candidates total candidates total candidates total
votes over (/) votes over (/) votes over (/) votes over (/)
total votes total votes total votes total votes
casted are casted are casted are casted are
shown shown shown shown
4. Each 4. Each 4. Each 4. Each
candidates % of candidates % of candidates % of candidates % of
votes received votes received votes received votes received
is shown is shown is shown is shown
5. Formatted as 5. Formatted as 5. Formatted as 5. Formatted as
% 2dp % 2dp % 2dp % 2dp
Innovation Went above Several own Caught your eye Attempted to -
and beyond the attempts of and as a marker be creative with
project and coming up with you found no result.
introduced own creative something (points for
concepts and solutions to interesting in effort)
ideas beefing solve the the system.
up the project. challenges in
the project.
Specifications The program The program The program The program is -
works and works and produces producing
meets all the produces the correct results incorrect
specifications. correct results but does not results.
and displays display them
them correctly. correctly.
It also meets
most of the
other
specifications
Readability The code is The code is The code is The code is
exceptionally fairly easy to readable only poorly
well organized read. by someone organized and
and very easy who knows very difficult to
to follow what it is read.
supposed to be
doing.
Reusability The code could Most of the Some parts of The code is not
be reused as a code could be the code could organized for
whole, or each reused in other be reused in reusability.
routine could programs. other programs
be reused.
Documentation The The The The
documentation documentation documentation documentation
is well written consists of is simply is simply
and clearly embedded comments comments
explains what comment and embedded in embedded in
the code is some simple the code with the code and
accomplishing header some simple does not help
and how. documentation header the reader
that is comments understand the
somewhat separating code.
useful in routines.
understanding
the code.
Efficiency The code is The code is The code is The code is
extremely fairly efficient brute force and huge and
efficient without unnecessarily appears to be
without sacrificing long patched
sacrificing readability and together.
understanding
readability and
understanding