def voter_statistics(total_votes_cast, total_valid_votes, voter_register):
# Calculate percentage of valid votes from total votes cast
percent_valid_from_total = (total_valid_votes / total_votes_cast) * 100
# Calculate percentage of valid votes from voter register
percent_valid_from_register = (total_valid_votes / voter_register) * 100
return {
“Total Votes Cast”: total_votes_cast,
“Valid Votes”: total_valid_votes,
“Voter Register”: voter_register,
“Valid Votes % of Total Votes”: round(percent_valid_from_total, 2),
“Valid Votes % of Voter Register”: round(percent_valid_from_register, 2)
}
# Example usage with Ghana 2024 election data
stats = voter_statistics(
total_votes_cast=11430531, # Total votes cast
total_valid_votes=11191422, # Valid votes
voter_register=18774159 # Total registered voters
)
for key, value in stats.items():
print(f”{key}: {value}”)



