title: Removing items from list if argument is False
body: <p>My code is to check if the time is valid, it returns list with True and False, depends, however I want if it's False to remove it from the list.</p>
  
  <p>Here's my code </p>
  
  <pre><code>def markValid(s):
          a = []
          if len(s) &gt; 2:
              if s[1] - s[0] &gt; 0.1:
                  a.append(True)
              else:
                  a.append(False)
              for i in range(1, len(s) - 1):
                  if s[i] - s[i - 1] &lt; 0.1 or s[i + 1] - s[i] &lt; 0.1:
                      a.append(False)
                  else:
                      a.append(True)
              if s[-1] - s[-2] &gt; 0.1:
                  a.append(True)
              else:
                  a.append(False)
              return a
          if len(s) == 1:
              return [True]
          if len(s) == 2 and s[1] - s[0] &gt; 0.1:
              return [True, True]
          else:
              return [False, False]
  </code></pre>