I have the following list of dictionaries:
voting_data = [ {"county":"Arapahoe", "registered_voters": 422829}, {"county":"Denver", "registered_voters": 463353}, {"county":"Jefferson", "registered_voters": 432438}]
I need to create a for-loop that, when executed, will produce the following sentences:
"Arapahoe County has 422,829 registered voters" (and so on).
I've been stuck on this all day, and have tried different loops/variables. I can't wrap my head around it. I understand that I'm looking to retrieve the index values of each item (so, for "county":"Arapahoe" I'm looking to retrieve "Arapahoe" and for "registered_voters": 422829, "422829").
Most recently, I came up with:
for counties_dict in voting_data:
for i in counties_dict.values("county") and j in counties_dict.values("registered_voters"):
print(f" {i} county has {j:,} registered voters")