Hi I need to print a Dictionary showing the key and the value divided by another variable ... any suggestions the code I have tried is below
#Dim variables
total_votes = 0
candidate = {}
for row in csvreader:
if row[2] in candidate.keys():
candidate[row[2]] += 1
else:
candidate[row[2]] = 1
total_votes += 1
for key, value in candidate.items():
percentage = int(value) / int(total_votes)
print((key) + " v " + (percentage))
print(f"Tolal votes {total_votes}")
question from:https://stackoverflow.com/questions/65640683/python-printing-dictionary-key-and-value-divided-by-another-variable