Confused about looping through list of people in Python
<p>I'm having issues with an exercise that is asking me to loop through my list of people and print everything that I know about each person while using a dictionary for each person. I'm trying to start out by just getting Python to accept and loop through my dictionaries, but whenever I try to run my code, I get an error message stating: "Value Error: too many values to unpack. (expected 2)"</p>

<pre><code>dictionaries_v = {

    'first_name': 'victor',
    'last_name': 'croc',
    'age': 21,
    'city': 'new york',
    }

dictionaries_c = {

    'first_name': 'charmy',
    'last_name': 'bee',
    'age': 8,
    'city': 'new york',
    }

dictionaries_e = {

    'first_name': 'espio',
    'last_name': 'armadilo',
    'age': 15,
    'city': 'new york',
    }

people = ['dictionaries_v', 'dictionaries_c', 'dictionaries_e']

for key, value in people:

    print( "\n" + key + ": " + value)
</code></pre>

<p>Thank you for your time.</p>

<p><code>people</code> is a list. You can only get one value at a time from a list. However, its <em>elements</em> are dictionaries. So, the following loop would work:</p>

<pre><code>for element in people:
    for key, value in element:
        print( "\n" + key + ": " + value)
</code></pre>

<p>The outer loop goes through each dictionary in <code>people</code>, and sets <code>element</code> to that dictionary. The inner loop goes through that dictionary and sets <code>key</code> to a key and <code>value</code> to a value.</p>

<p>Also, you set <code>people</code> to <code>['dictionaries_v', 'dictionaries_c', 'dictionaries_e']</code>. Instead of setting each of its elements to a string, set it to the variables themselves: <code>[dictionaries_v, dictionaries_c, dictionaries_e]</code>.</p>

python