title: Python ; IF word in line and word2 not in line
body: <p>Apologies for being a noob here , as i am a newbie in this </p>
  
  <p>i have been trying to write a code which could find a certain words in line and then match from 2nd list of words to see if 2nd word exist in the same line.
  only print line only if first word exist not both in a line; here is the snippet and example</p>
  
  <pre><code>keywords =("a","b","c","d")
  keywords2 = ("e","f","g")
  a = ("a  is a ", "a is not e","b is b", "b is not f")
  for key2 in keywords2:              
      for key in keywords:                
  
          for line in a:
  
                  if key2 not in line:
                      if key in line:
  
                          print(key+" Found in --&gt; ")
                          print      (line)
  </code></pre>
  
  <p>the output required is </p>
  
  <pre><code>a is a
  b is b
  </code></pre>
  
  <p>while we have </p>
  
  <pre><code>a Found in --&gt; 
  a  is a 
  b Found in --&gt; 
  b is b
  b Found in --&gt; 
  b is not f
  a Found in --&gt; 
  a  is a 
  a Found in --&gt; 
  a is not e
  b Found in --&gt; 
  b is b
  a Found in --&gt; 
  a  is a 
  a Found in --&gt; 
  a is not e
  b Found in --&gt; 
  b is b
  b Found in --&gt; 
  b is not f
  </code></pre>
  
  <p>i have tried few ways to implement the loop but to no use </p>