import time
print("You're about to vote for your future president")
time.sleep(2)
print("The aspirant are 'JOSEPH' & 'Chinedu'")
print()
#nominee vote count
nominee1v= 0
nominee2v = 0
# voters Id the user will select from
voters_id = [1,2,3,4,5,6,7,8,9,10]
# length of voters id
numf = len(voters_id)
# a continuous while loop to run your vote
while True:
# if the voters ID is empty. we assume our vote has ended.
if voters_id == []:
print("Voting session has ended")
# it's time to determine the winner
# if first nominee vote is greater. then, we do our calculation
if nominee1v > nominee2v:
perc = (nominee1v / numf)* 100
print(f"Joseph have won with {perc}% vote")
break
# else if the second nominee vote is greater. then, we do our calculation
elif nominee2v > nominee1v:
perc = (nominee2v / numf)* 100
print(f"Chinedu have won with {perc * 100}% vote")
break
# here's where our code runs if the voters id is not empty
else:
# we ask our voter to choose an id and choose who to vote for.
print(f"Here's all the voters id. {voters_id}. ")
voter = int(input("Enter your vote id: "))
# if your vote ID is the list of voters_id
if voter in voters_id:
# the it'll ask for who you wish to vote for. J OR C
vote = input("Enter your vote, 'J' OR 'C'~: ").casefold()
# if the the user selected J. it'll add 1 to our nominee 1
if vote == 'j':
nominee1v += 1
print("Your vote for JOSEPH have been recorded. Thank you for your vote")
# then remove the user selected id from thr list of voters_id
voters_id.remove(voter)
# if the the user selected C. it'll add 1 to our nominee 2
elif vote == 'c':
nominee2v += 1
print("Your vote for Chinedu have been recorded. Thank you for your vote")
voters_id.remove(voter)
# if the user selected another alphabet apart from J OR C. it returns "he's not a president
# aspirant and continue again
else:
print("he's not a president aspirant")
continue
# if the voter repeat the voters ID or select ID that's not on the voters_id list. then
# it print this message
else:
print("You're not a voter here or you've already voted!")
Thanks for coming