How to make a voting system using python | Python Project

preview_player
Показать описание
this project is about voting system for two nominees
and 10 voters
---------------------------
----------------------------------------------------------------------------------------------------

---------------------------
Рекомендации по теме
Комментарии
Автор

hi there, thanks for sharing this. btw i have a problem regarding the code. in this video, when input the voter_id that not include in the list, the output is not ("You are not voter or You already voted ") instead always asking the valid input voter_id. do you know how to fix this? really appreciate it thanks

misdkal
Автор

Thank you so much! This was genuinely so useful.

SilPherr
Автор

SOURCE CODE :---


nominee1 = input("Enter The Name Of The First Nominee: ")
nominee2 = input("Enter The Name Of The Second Nominee: ")


nm1_votes = 0
nm2_votes = 0


voter_id = [1, 2, 3, 4, 5]

no_of_voter = len(voter_id)

while True:
if voter_id == []:
print("Voting Session Is Over !!!")
if nm1_votes > nm2_votes:
percent = (nm1_votes/no_of_voter)*100
print(nominee1, "has won the election with", percent, "% of votes")
break
elif nm2_votes > nm1_votes:
percent = (nm2_votes/no_of_voter)*100
print(nominee2, "has won the election with", percent, "% of votes")
break
else:
print("Both Have Equal No Of VOtes !!! ")


voter =int(input("Enter Your Voter Id : "))
if voter in voter_id:
print("You Are A Valid Voter")
voter_id.remove(voter)

print("To Give Vote To ", nominee1, "Press 1")
print("To Give Vote To ", nominee2, "Press 2")

vote = int(input("Enter Your Preciour Vote : "))
if vote == 1:
nm1_votes += 1
print("Thank You For Voting", nominee1)
elif vote == 2:
nm2_votes += 1
print("Thank You For Voting", nominee2)
elif vote > 2 :
print("You Press Wrong Key")
else:
print("You Are Not A Voter or You Are Already Voted")

arindamsaha
Автор

Thank you so much !this code is so useful thank you so much

venkatasasikirantulluri
Автор

Zoom the video. I can't read the codes

samrakshanrijal
visit shbcf.ru