title: using 'not' and 'or' together in Python
body: <p>In Python 2.5, I used the code:</p>
  
  <pre><code>    yn=raw_input('''This program is for solving linear and quadratic equations.
      Is this what you want to do?
      ''')
      if not 'y' in yn or 'Y' in yn:
          print 'Program now quitting.'
  </code></pre>
  
  <p>to display <code>Program now quitting</code> when the program closed, which was supposed to happen when yn did not contain 'y' or 'Y', but it was also displayed when yn did contain 'Y', before the rest of the program started.  I think that the bug was caused by the use of 'or' and 'not' together, since it didn't change when I changed <code>if not 'y' in yn or 'Y' in yn:</code> to <code>if not 'y' in yn or not 'Y' in yn:</code>, but disappeared when I changed it to</p>
  
  <pre><code>    if not 'y' in yn:
          if not 'Y' in yn:
  </code></pre>
  
  <p>Is this right? What, if anything, could I do to solve the problem and keep this part in the same line?</p>