I'm learning about dictionaries, and I know I could do this by creating two more dictionaries, but for brevity's sake, I wanted to make the code a bit more concise than having to create two more dict (granted, in the end, everything I wrote out for this dict would have to be written in the other dicts), so I guess I'm more curious than anything. And I know that I shouldn't be using a for-loop, but I don't know another way, and as far as LPTH sucking, I had to start somewhere.
question 1: How can I get this to cycle through each state/abbrev/city? Would I have to just make multiple dicts, or a series of lists and use those? question2: Why does this code run the for-loop 11 times?
states1 = {
'1': 'Oregon', 'a': 'OR','population': '1000',
'2': 'Florida', 'b': 'MI', 'population': '1000',
'3': 'California', 'c': 'CA', 'population': '1000',
'4': 'NewYork', 'd': 'NY', 'population': '1000',
'5': 'Michigan','e': 'MI','population': '1000',
}
for city, pop, in states1.items():
print "%s has the abbreviation %s and a population of %s" %states1['1'], states1['a'], states1['population'])