title: Multiple If/else in list comprehension in Python
body: <p>I have this</p>
  
  <pre><code>s = ['son','abc','pro','bro']
  b = ['son','bro']
  c = ['pro','quo']
  </code></pre>
  
  <p>The expected output is this. Where items in the output are <code>index(item_in_s)</code> if it is present in list <code>b</code>. Or <code>index(item_in_s)+10</code> if an item is in <code>c</code>.</p>
  
  <pre><code>[0,12,3]
  </code></pre>
  
  <p>I tried this:</p>
  
  <pre><code>index_list = [s.index(item) if item in b else s.index(item)+10 if item in c for item in s]
  print(index)
  </code></pre>
  
  <p>But apparently this is a syntax error. So I tried this:</p>
  
  <pre><code>index_list = [s.index(item) if item in b else s.index(item)+10 for item in s if item in c]
      print(index)
  </code></pre>
  
  <p>Output:</p>
  
  <pre><code>[12]
  </code></pre>
  
  <p>This just changes the whole logic. Although I could do this</p>
  
  <pre><code>fin = [s.index(item) if item in b else s.index(item)+10 if item in c  else '' for item in s]
  fin = [item for item in fin if item!='']
  print(fin)
  </code></pre>
  
  <p>Desired output obtained:</p>
  
  <pre><code>[0, 12, 3]
  </code></pre>
  
  <p>But how do I obtain what I want in list comprehension itself or is there something like <code>else continue</code> in list comprehensions?</p>