title: using "OR" in a for-if-elif-else loop producing undesired result in Jupyter notebook
body: <p>I have a dataset , in which one of the columns is Degree, from that column i want to looking for a particular keyword and for that keyword i want to add a short form in a list.
  My initial code works fine for me:</p>
  <pre><code>c = []
  
  for words in df['Degree'].values:
      
      if &quot;(m.tech)&quot; in words.lower():
          c.append(&quot;M.Tech&quot;)
      elif &quot;m.tech&quot; in words.lower():
          c.append(&quot;M.Tech&quot;)
      elif &quot;(m.sc)&quot; in words.lower():
          c.append(&quot;M.Sc&quot;)
      elif &quot;m.sc&quot; in words.lower():
          c.append(&quot;M.Sc&quot;)
      elif &quot;post&quot; in words.lower():
          c.append(&quot;PG&quot;)
      elif &quot;(b.tech)&quot; in words.lower():
          c.append(&quot;B.Tech&quot;)
      elif &quot;(b.e)&quot; in words.lower():
          c.append(&quot;B.Tech&quot;)
      elif &quot;b.tech&quot; in words.lower():
          c.append(&quot;B.Tech&quot;)
      elif &quot;b.e&quot; in words.lower():
          c.append(&quot;B.Tech&quot;)
      else:
          c.append(np.nan)
  </code></pre>
  <p>But i want to make it small using &quot;OR&quot; . so i wrote:</p>
  <pre><code>d = []
  
  for words in df['Degree'].values:
      if &quot;(m.tech)&quot; or &quot;m.tech&quot; in words.lower():
          d.append(&quot;M.tech&quot;)
      elif &quot;(m.sc)&quot; or &quot;m.sc&quot; in words.lower():
          d.append(&quot;M.Sc&quot;)
      elif &quot;(b.tech)&quot; or &quot;b.tech&quot; or &quot;b.e&quot; or &quot;(b.e)&quot; in words.lower():
          d.append(&quot;B.Tech&quot;)
      elif &quot;post&quot; or &quot;pg&quot; in words.lower():
          d.append(&quot;PG&quot;)
      else:
          d.append(np.nan)
          
  </code></pre>
  <p>In this piece of code, what i get is only &quot;M.Tech&quot; values , even if if has nan value.</p>
  <p>Any help ?</p>