title: How to list out odd and even numbers from a list of numbers using if and else statement under list comprehensions in Python?
body: <p>I am writing some code to separate even and odd numbers from a list of numbers. </p>
  
  <p>I can extract even numbers from the list using if statement under list comprehensions but I don't know how to use else statement under list comprehension and get the odd numbers list output.</p>
  
  <p>Code:</p>
  
  <pre><code>evenList = [num for num in range (0,11) if num%2==0]
  print(f'Even numbers from the list are {evenList}')
  </code></pre>
  
  <p>Desired output:</p>
  
  <pre><code>Even numbers from the list are [2, 4, 6, 8, 10]
  Odd numbers from the list are [1, 3, 5, 7, 9]
  </code></pre>