title: How can I add items to an empty set in python
body: <p>I have the following procedure:</p>
  
  <pre><code>def myProc(invIndex, keyWord):
      D={}
      for i in range(len(keyWord)):
          if keyWord[i] in invIndex.keys():
                      D.update(invIndex[query[i]])
      return D
  </code></pre>
  
  <p>But I am getting the following error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "&lt;stdin&gt;", line 3, in &lt;module&gt;
  TypeError: cannot convert dictionary update sequence element #0 to a sequence
  </code></pre>
  
  <p>I do not get any error if D contains elements. But I need D to be empty at the beginning.</p>