title: python - Single Line Nested For Loops
body: <p>What will be python single line equivalent of below code?</p>
  
  <pre><code>l=[]
  for i in range(3,5) :
      if i==3:
          for j in range(0,2):
              if i%2:
                  l.append(i*j)
              else:
                  l.append(i+j)
      else:
          l.append(i)
  print(l)
  </code></pre>
  
  <p>I tried using a single line for nested loop but with only one condition like this:</p>
  
  <pre><code>print([i*j if i%2 else i+j for i in range(3,5) for j in range(0,2)])
  </code></pre>
  
  <p>Note: Here i want to learn how to use single line equivalent for nested loops with if else condition in both the loops.
  Also if it's not possible then specify why not!</p>
  
  <p>Thanks in advance :)</p>