title: Python3: What is the proper format for compounding continue statements. x and (y or z)
body: <p>My program reads file names and categorizes their line count based on the file name. I am currently trying to error proof my code to report any regular appearing files that aren't .txt or .xlsx. The reason I am asking and not just finishing with an else statement is because it will regularly have to sift though .zip, .csv, .xls that will need a similar statement. I found this question for another language but I don't understand how to translate it to python.</p>
  
  <p>What I am trying to make python understand:</p>
  
  <blockquote>
    <p>True if:
    x is necessary AND (either y OR z)</p>
  </blockquote>
  
  <p>so it needs two things but the second thing is flexible</p>
  
  <pre><code>if os.path.isfile(fname) and file.endswith != ".txt" or file.endswith != ".xlsx":
    cant_read += 1
  </code></pre>
  
  <p>My attempt at the logic is:</p>
  
  <pre><code>x = 2
  z = 2
  y = 3
  w = 2
  
  if x == z and (x == (y or w)):
      print(True)
  else:
      print(False)
  </code></pre>
  
  <blockquote>
    <p>This code logic gives me False as is and True if y and w are swapped. y = 2 and w = 3</p>
  </blockquote>
  
  <p>Right now I've only been using this for an error counter, but I will need it for the other extensions soon.</p>
  
  <p>Thanks, if anyone can explain the format to me it's been on my "to figure out" list for awhile. </p>