title: NoneType' object has no attribute 'items
body: <p>I don't really know where I went wrong. Can you please help me? I keep getting this error when uploading the code to school correction system.</p>
  
  <pre><code>  -- test: 1
    -- failed
  
    -- standard error
    Traceback (most recent call last):
      File "/proc/self/fd/3", line 6, in &lt;module&gt;
        print(sorted(new_dict.items()))
    AttributeError: 'NoneType' object has no attribute 'items'
    --
    -- exit code: 1
                  (anything other than 0 indicates an error)
                  (all scripts are killed after three seconds)
  
    -- expected standard output
    [(4, 'a'), (10, 'c')]
    --
  
    -- actual standard output (max 200 lines)
    [(4, 'a'), (10, 'c')]
    --
  </code></pre>
  
  <p>My code is:</p>
  
  <pre><code>import sys
  
  def swap_unique_keys_values(n):
      d = {}
      for i in n:
          if not n[i] in d:
              d[n[i]] = i
          else:
              del d[n[i]]
      print(sorted(d.items()))
  
  def main():
      swap_unique_keys_values(sys.argv[1])
  
  if __name__ == '__main__':
      main()
  </code></pre>
  
  <p>The input is a dictionary. Any help is really appreciated.</p>