title: How can I use if/else in list comprehensions?
body: <p>I'm trying to create a list with even numbers showing as they are and odd numbers showing as "odd".</p>
  
  <p>Here is the code I am trying. </p>
  
  <pre><code>lst = [if x % 2 == 0 else 'odd' for x in range(11)]
  </code></pre>
  
  <p>I expected to get something like this </p>
  
  <pre><code>[0, "odd", 2, "odd", 4, "odd", 6, "odd", 8, "odd", 10]
  </code></pre>
  
  <p>But I keep getting <code>SyntaxError</code> exception:</p>
  
  <pre><code>&gt;&gt;&gt; lst = [if x % 2 == 0 else 'odd' for x in range(11)]
    File "&lt;stdin&gt;", line 1
      lst = [if x % 2 == 0 else 'odd' for x in range(11)]
              ^
  SyntaxError: invalid syntax
  </code></pre>
  
  <p>What am I doing wrong?</p>