0% found this document useful (0 votes)
22 views4 pages

Election Management System Overview

Uploaded by

bhuvandevil808
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views4 pages

Election Management System Overview

Uploaded by

bhuvandevil808
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

ELECTION MANAGEMENT SYSTEM

SOURCE CODE

1. Voter Registration

voters = {}

def register_voter():
voter_id = input("Enter your Voter ID: ")
name = input("Enter your name: ")
age = int(input("Enter your age: "))
if age < 18:
print("You are not eligible to vote.")
return
if voter_id in voters:
print("You are already registered.")
else:
voters[voter_id] = {"name": name, "has_voted": False}
print(f"Voter {name} registered successfully.")

2. Candidate Registration

candidates = {}

def register_candidate():
candidate_id = input("Enter candidate ID: ")
name = input("Enter candidate name: ")
party = input("Enter party name: ")
if candidate_id in candidates:
print("Candidate already registered.")
else:
candidates[candidate_id] = {"name": name, "party": party, "votes": 0}
print(f"Candidate {name} from {party} registered successfully.")

3. Voting Function

def vote():
voter_id = input("Enter your Voter ID to vote: ")
if voter_id not in voters:
print("You are not registered!")
return
if voters[voter_id]["has_voted"]:
print("You have already voted.")
return

print("Candidates List:")
for cid, info in [Link]():
print(f"{cid}: {info['name']} ({info['party']})")

choice = input("Enter candidate ID to vote: ")


if choice in candidates:
candidates[choice]["votes"] += 1
voters[voter_id]["has_voted"] = True
print("Your vote has been recorded. Thank you!")
else:
print("Invalid candidate ID.")

4. Show Results

def show_results():
print("\nElection Results:")
for cid, info in [Link]():
print(f"{info['name']} ({info['party']}): {info['votes']} votes")

5. Main Menu

def main():
while True:
print("\n==== ELECTION MENU ====")
print("1. Register Voter")
print("2. Register Candidate")
print("3. Cast Vote")
print("4. Show Results")
print("5. Exit")
choice = input("Enter your choice: ")
if choice == '1':
register_voter()
elif choice == '2':
register_candidate()
elif choice == '3':
vote()
elif choice == '4':
show_results()
elif choice == '5':
break
else:
print("Invalid choice. Try again.")

# Start the program


main()
OUTPUTS
➢ Voter Registration:
User enters Voter ID, Name, and Age. If age >= 18, voter is registered.

➢ Candidate Registration:
Admin enters Candidate ID, Name, and Party to register the candidate.

➢ Voting:
Voter selects candidate ID. If valid and hasn't voted, vote is recorded.

➢ Show Results:
Displays vote count for each candidate with party name.

➢ Exit:
Terminates the election program.

➢ Main Menu Screen:


[Insert Screenshot Here]

➢ Voter Registration Form:


[Insert Screenshot Here]

➢ Candidate Registration Form:


[Insert Screenshot Here]

➢ Voting Screen:
[Insert Screenshot Here]

➢ Result Display:
[Insert Screenshot Here]

You might also like