Python dictionary update and refinement loop
<p>I am trying to create a loop that will further refine a user defined dictionary after original pass and parse of user string:</p>

<pre><code>product_info = {'make': [], 'year': [], 'color': []}

make = ['honda','bmw','acura']
year = ['2013','2014','2015','2016']
colors = ['black','grey','red','blue']

user_input = raw_input()

for m in make:
    if m in user_input:
        product_info['make'].append(m)
for y in year:
    if y in user_input:
        product_info['year'].append(y)
for c in color:
    if c in user_input:
        product_info['color'].append(c)
</code></pre>

<p>Here is where I would like to check that dictionary and make sure that all values are filled, and if not, ask for more input to refine the existing dictionary:</p>

<p>example: <code>I am looking for a grey car</code></p>

<pre><code>product_info = {'make': [], 'year': [], 'color': ['grey']}

if product_info['make'] is null:
    print 'what make of car are you looking for?'

    new_input = 'i am looking for a 2015 honda'
</code></pre>

<p>send the string again through the dictionary/parse process and update the product_info dictionary if there is a value to fill in and also look to see if they mentioned a year this time around, etcâ¦</p>

<p>updated dict:</p>

<pre><code>product_info = {'make': ['honda'], 'year': ['2015'], 'color': ['grey']}
</code></pre>

<p>How do I take in new user input requesting more information and parse through it, looking for the attributes, and update the existing dictionary without modifying old attributes?</p>

<pre><code>while [] in product_info.values():
    for key in product_info:
        if product_info[key] == []:
            print("What",key)
            user_input = raw_input() 
            for each in user_input.split(' '):
                if each in make:
                    key = 'make'
                    product_info[key].append(each)
                elif each in year:
                    key = 'year'
                    product_info[key].append(each)
                elif each in colors:
                    key = 'color'
                    product_info[key].append(each)
</code></pre>

<p>This very rough, working system, you could refine it, but that's up to you.</p>

python dictionary