title: How do I get the index of the common integer element from two separate lists and plug it to another list?
body: <hr>
  
  <p>I have 3 lists.</p>
  
  <pre><code>A_set = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
  </code></pre>
  
  <pre><code>Q_act = [2, 3]
  </code></pre>
  
  <pre><code>dur = [0, 4, 5, 2, 1, 3, 4, 8, 2, 3]
  </code></pre>
  
  <p>All lists are integers.</p>
  
  <p>What I am trying to do is to compare <code>Q_act</code> with <code>A_set</code> then obtain the indices of the numbers that match from <code>A_set</code>.</p>
  
  <p>(Example: 
  <code>Q_act</code> has the elements <code>[2,3]</code>
  it is located in indices <code>[1,2]</code> from <code>A_set</code>)</p>
  
  <p>Afterwards, I will use those indices to obtain the corresponding value in <code>dur</code> and store this in a list called <code>p_dur_Q_act</code>.</p>
  
  <p>(Example: using the result from the previous example, <code>[1,2]</code></p>
  
  <p>The values in the <code>dur</code> list corresponding to the indices <code>[1,2]</code> should be stored in another list called <code>p_dur_Q_act</code></p>
  
  <p>i.e. <code>[4,5]</code> should be the values stored in the list <code>p_dur_Q_act</code>)</p>
  
  <p>So, how do I get the index of the common integer element (which is <code>[1,2]</code>) from two separate lists and plug it to another list?</p>
  
  <hr>
  
  <p>So far here are the code(s) I used:</p>
  
  <p>This one, I wrote because it returns the index. But not <code>[4,5]</code>.</p>
  
  <pre><code>p_Q = set(Q_act).intersection(A_set)
      p_dur_Q_act = [i + 1 for i, x in enumerate(p_Q)]
      print(p_dur_Q_act)
  </code></pre>
  
  <p>I also tried this but I receive an error <code>TypeError: argument of type 'int' is not iterable</code></p>
  
  <pre><code> p_dur_Q_act = [i + 1 for i, x in enumerate(Q_act) if any(elem in x for elem in A_set)]
      print(p_dur_Q_act)
  </code></pre>