title: Using an 'or' operator in a basic python list comprehension
body: <p>Question: How can I use OR in a python list comprehension?</p>
  <p>I am looking to output any number between 0-99 that is either divisible by 5 or 7 with no remainder. I have the following code:</p>
  <pre><code>numbers = [x for x in range(99) if x % 5 == 0 if x % 7 == 0]
  </code></pre>
  <p>but this returns: 0, 35, 70
  which are the numbers divisible by both 5 and 7. I also tried:</p>
  <pre><code>numbers = [x % 5 == 0 or x % 7 == 0 for x in range(99)]
  </code></pre>
  <p>but this returns True or False for each number, where I am looking to get the numbers themselves. Using this:</p>
  <pre><code>numbers = [x for x in range(99) if x % 5 == 0 or if x % 7 == 0]
  </code></pre>
  <p>throws a syntax error.</p>
  <p>I have looked over the following pages but was not able to understand how to apply the solutions if they were presented. They each seemed to offer nuances to my desired solution, but were not what I was looking for.</p>
  <p><a href="https://www.datacamp.com/community/tutorials/python-list-comprehension" rel="nofollow noreferrer">datacamp.com/community/tutorials/python-list-comprehension</a></p>
  <p><a href="https://www.programiz.com/python-programming/list-comprehension" rel="nofollow noreferrer">programiz.com/python-programming/list-comprehension</a></p>
  <p><a href="https://stackoverflow.com/questions/44321085/use-of-or-operator-in-python-lambda-function">use-of-or-operator-in-python-lambda-function</a></p>
  <p><a href="https://stackoverflow.com/questions/35420381/not-comprehending-list-comprehension-in-python/35420460#35420460">not-comprehending-list-comprehension-in-python</a></p>
  <p><a href="https://stackoverflow.com/questions/29251618/is-there-a-binary-or-operator-in-python-that-works-on-arrays/29251709#29251709">is-there-a-binary-or-operator-in-python-that-works-on-arrays</a></p>
  <p><a href="https://stackoverflow.com/questions/57934869/how-to-convert-this-my-code-into-a-list-comprehension/57934976#57934976">how-to-convert-this-my-code-into-a-list-comprehension</a></p>
  <p><a href="https://stackoverflow.com/questions/15248272/python-list-comprehension-with-multiple-ifs/15248356#15248356">python-list-comprehension-with-multiple-ifs</a></p>