title: iterate list and compare it's values with dict
body: <p>I am dealing with 1. list of dictionaries and 2. list. I am trying to:<br>
  1. iterate through list (list1),<br>
  2. Match the list1's value with the <code>ID</code> of API response, if found- put entire dict in a new_dict
  3. else skip</p>
  
  <p>API response in Json format:  </p>
  
  <pre><code>   list_of_dict=[{"id":1500,
        "f_name": "alex",
         "age": 25
        },
  
        {"id" :1501,
         "f_name":"Bob",
         "age": 30
        },
        {"id" :1600,
         "f_name":"Charlie",
         "age": 35
        }
        ...
       ]
  </code></pre>
  
  <p>And a list1:  </p>
  
  <pre><code>list1=[1500,1501,1211.....]
  </code></pre>
  
  <p>According to this, <code>1500 &amp; 1501</code> is present in list_of_dict so that entire dict will be added in new_dict. </p>
  
  <p>My attempt:    </p>
  
  <pre><code>new_dict=dict()
  for i,val in enumerate(list1):
      #assuming val found in dict
      #so put it in new dict
      print i ,"=",val
      new_dict.update({"id": val,"name":name, "age":age})
  </code></pre>
  
  <p>What i see is this code taking only last item of the list and updates the dict.. but in my case, new_dict will contains two dictionaries with id <code>1500</code> and <code>1501</code>. What i am missing? </p>