title: python - if not in list
body: <p>I have two lists:</p>
  
  <pre><code>mylist = ['total','age','gender','region','sex']
  checklist = ['total','civic']
  </code></pre>
  
  <p>I have to work with some code I have inherited which looks like this:</p>
  
  <pre><code>for item in mylist:
      if item in checklist:
          do something:
  </code></pre>
  
  <p>How can I work with the code above to tell me that <strong>'civic' is not in mylist</strong>?.</p>
  
  <p>This would've been the ideal way to do it but I cant use it, don't ask me why. </p>
  
  <pre><code>for item in checklist:
      if item not in mylist:
          print item
  </code></pre>
  
  <p>Outcome:</p>
  
  <pre><code>civic
  </code></pre>