title: Remove data that doesn't meet one of two criteria
body: <p>I've written a short function to remove data from my list provided it's higher than some threshold value (here 0.04) and it works as follows:</p>
  
  <pre><code>def remove_noise(time_data, volt_data):
  
  volt_clean = []
  time_clean = []
  
  for q in range(0, len(volt_data)):
  
      if volt_data[q] &gt;=0.04:           
          time_clean.append(time_data[q])
          volt_clean.append(volt_data[q])
  
  return volt_clean, time_clean
  </code></pre>
  
  <p>What I want to do is, instead of having one threshold value, check if the data is greater than one value OR lower than another value I pass to the function. Here's what I've written so far:</p>
  
  <pre><code>def remove_noise(time_data, volt_data, sma_max, sma_min):
  
  volt_clean = []
  time_clean = []
  
  for q in range(0, len(volt_data)):
  
      if volt_data[q] &gt;=sma_max:
          or volt_data[q] &lt;=sma_min           
          time_clean.append(time_data[q])
          volt_clean.append(volt_data[q])
  
  return volt_clean, time_clean
  </code></pre>
  
  <p>I want to keep all the elements of <code>volt_data</code> that are <code>&gt;=sma_max</code> or <code>&lt;=sma_min</code> but I'm not sure the correct way to write the syntax as Python is giving me a syntax error with second version I wrote. How would you write this <code>or</code> statement? I also tried with <code>elif</code> instead of <code>or</code> but it still didn't work.</p>