A simple command-line Electronic Voting Machine (EVM) built using Python. This project simulates a basic election system where users can view nominees, cast votes, check vote counts, view election results, and reset the EVM.
The project also uses file handling to permanently store the current vote counts and maintain the history of completed elections.
- View the list of nominated candidates
- Cast votes for candidates or NOTA
- Display the election winner
- Detect tied elections
- Show total vote count
- Show individual candidate vote counts
- Save current votes using file handling
- Load previously saved votes when the program starts
- Store completed election results in a separate history file
- Save the election winner in the history
- Reset all votes after confirmation
- Menu-driven command-line interface
1. Nomination Detail
2. Voting
3. Result
4. Vote Score
5. EVM Reset
6. Exit
- Nominee A
- Nominee B
- Nominee C
- Nominee D
- Nominee E
- NOTA (None Of The Above)
The project uses two text files:
Stores the current election vote counts.
Example:
A=5
B=3
C=2
D=1
E=0
NOTA=1
The file is updated whenever a valid vote is cast.
Stores the history of completed elections, including vote counts and the winner.
Example:
==================================================
Election
A=5
B=3
C=2
D=1
E=0
NOTA=1
Winner=Nominee A
The history file uses append mode, so previous election records are preserved when a new election is saved.
Select the Operation
1. Nomination Detail
2. Voting
3. Result
4. Vote Score
5. EVM Reset
6. Exit
Enter the Choice: 2
1.Nominee A
2.Nominee B
3.Nominee C
4.Nominee D
5.Nominee E
6.NOTA
Enter Your Vote: 1
Vote Saved Successfully
- Python functions
- Global variables
- Conditional statements
- Loops
- User input handling
- Dictionary and list concepts
- File handling
- Reading and writing text files
- Append mode for maintaining history
- Working with persistent data
- Menu-driven applications
- Basic election result logic
- Tie detection
- Python
- File Handling
- Text Files
- Command-Line Interface (CLI)
- Add voter authentication
- Prevent duplicate voting
- Add voter ID verification
- Store data using JSON or a database
- Generate detailed election reports
- Add date and time to election history
- Create a graphical interface using Tkinter
- Add an administrator panel
Contributions and suggestions are welcome. Feel free to fork this repository and submit a pull request.
This project is open source and available under the MIT License.