CHATGPT AI
calculating
the total number of votes
total_votes = len(candidates)
#calculating the vote percentage of each candidate
vote_percentage = [(candidate/total_votes)*100 for candidate in votes]
#creating a dictionary to store the results
results = dict(zip(candidates, vote_percentage))
#finding the winner of the election
max_vote = max(results, key=results.get)
#printing out the results
print("Election Results")
print("-------------------------")
print(f"Total Votes: {total_votes}")
print("-------------------------")
#iterating through the dictionary and printing out the results
for candidate, percentage in results.items():
print(f"{candidate}: {percentage:.3f}% ({votes[candidate]})")
#finding and printing out the winner of the election
print("-------------------------")
print(f"Winner: {max_vote}")
total_votes = len(candidates)
#calculating the vote percentage of each candidate
vote_percentage = [(candidate/total_votes)*100 for candidate in votes]
#creating a dictionary to store the results
results = dict(zip(candidates, vote_percentage))
#finding the winner of the election
max_vote = max(results, key=results.get)
#printing out the results
print("Election Results")
print("-------------------------")
print(f"Total Votes: {total_votes}")
print("-------------------------")
#iterating through the dictionary and printing out the results
for candidate, percentage in results.items():
print(f"{candidate}: {percentage:.3f}% ({votes[candidate]})")
#finding and printing out the winner of the election
print("-------------------------")
print(f"Winner: {max_vote}")
the total number of votes
total_votes = len(candidates)
#calculating the vote percentage of each candidate
vote_percentage = [(candidate/total_votes)*100 for candidate in votes]
#creating a dictionary to store the results
results = dict(zip(candidates, vote_percentage))
#finding the winner of the election
max_vote = max(results, key=results.get)
#printing out the results
print("Election Results")
print("-------------------------")
print(f"Total Votes: {total_votes}")
print("-------------------------")
#iterating through the dictionary and printing out the results
for candidate, percentage in results.items():
print(f"{candidate}: {percentage:.3f}% ({votes[candidate]})")
#finding and printing out the winner of the election
print("-------------------------")
print(f"Winner: {max_vote}")
0 Comments & Tags
0 Anteile
1 Ansichten