Question: I'm having issues with Python dictionaries with lists containing tuples. Here's the folder with the csv and tester files: https://drive.google.com/drive/folders/1yYfSuRecJzeZSzm6UGfhC23WB8dmu0eI?usp=sharing Here's my code so far:

 I'm having issues with Python dictionaries with lists containing tuples. Here'sthe folder with the csv and tester files: https://drive.google.com/drive/folders/1yYfSuRecJzeZSzm6UGfhC23WB8dmu0eI?usp=sharing Here's my codeso far: def read_votes(filename): db1 = {} info_db1 = [] with open(filename,'r') as f: f.readline() for line in f: if(count == 5): str

I'm having issues with Python dictionaries with lists containing tuples.

Here's the folder with the csv and tester files:

https://drive.google.com/drive/folders/1yYfSuRecJzeZSzm6UGfhC23WB8dmu0eI?usp=sharing

Here's my code so far:

def read_votes(filename):

db1 = {}

info_db1 = []

with open(filename, 'r') as f:

f.readline()

for line in f:

if(count == 5):

str = line.split(',')

str[1] = str[1] + ',' + str[2]

else:

info_db1 = line.split(',')

#think setup

#AL: [(Johnson, IND, 44467, 0), (Stein, IND, 9391, 0)],

db1[info_db[1]] = (info[0]), info[2], int(info_db[3]), int(info_db[4]) == 'True')

return db1

= line.split(',') str[1] = str[1] + ',' + str[2] else: info_db1 =

dictionaries and file I/O Background The purpose of this assignment is to explore dictionaries and file reading and writing. We will be reading in some data about US elections', creating a structure that groups data by State, and then checking for various statistics What's attowed? here is the exhaustive list of things you can use on the project. all basic expressions/operators, indexing/slicing . all basic statements: assignment, selection, and loop statements, break/continue, return . functions: len), range). min), max(), int), str0, enumerate0. round0) .file Teading: open), close(), read), readline(), readlines0, with syntax methods: lists: .remove(), .insert), .append), .extend), .pop(), .popitem) strings: .strip(), .split(), .join(), .remove(), .insert(), .lower0 . reversed), reverse() This means that... you can't call anything not listed above. Focus on applying these functions to solve the task. you can't import any modules for this project. (so you can't import csv either but it isn't that helpful) dictionaries and file I/O Background The purpose of this assignment is to explore dictionaries and file reading and writing. We will be reading in some data about US elections', creating a structure that groups data by State, and then checking for various statistics What's attowed? here is the exhaustive list of things you can use on the project. all basic expressions/operators, indexing/slicing . all basic statements: assignment, selection, and loop statements, break/continue, return . functions: len), range). min), max(), int), str0, enumerate0. round0) .file Teading: open), close(), read), readline(), readlines0, with syntax methods: lists: .remove(), .insert), .append), .extend), .pop(), .popitem) strings: .strip(), .split(), .join(), .remove(), .insert(), .lower0 . reversed), reverse() This means that... you can't call anything not listed above. Focus on applying these functions to solve the task. you can't import any modules for this project. (so you can't import csv either but it isn't that helpful)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!