I'm back! Okay, I've got this text file with a list of data for 85 restaurants. The data is organized for each in this order: name, rating, price range, cuisine type. I am supposed to write a function that reads this file and returns a tuple of three dictionaries. I used file.readlines() to read the file in, then I stripped out all of the \n characters. This left me with list of data separated by an empty
string. I created the first dictionary by iterating through the indexes of the file, creating keys and values, but the other two dictionaries involved keys that had lists for values, and I just got stuck, so I populated them manually. I'm sure I'm supposed to create the dictionaries by reading the file, but I haven't been able to come up with code that works. What can I try to build these dictionaries by reading the file? I need a little nudge in the right direction.
Eureka!
This populates my first list. These nested loops require inside-out thinking, and it takes me a while to sort hem out. (That and I used Python Visualizer to step through the code. Nice little tool!)