title: Binary list from indices of ascending integer list
body: <p>I have an ascending list of integers <code>e</code> that starts from 0 and I would like to have a binary list <code>b</code> whose <code>i</code>-th element is 1 if and only if <code>i</code> belongs to <code>e</code>.</p>
  <p>For example, if <code>e=[0,1,3,6]</code>, then this binary list should be <code>[1,1,0,1,0,0,1]</code>,
  where the first 1 is because 0 is in <code>e</code>, the second 1 is because 1 is in <code>e</code>, the
  third 0 is because 2 is not in <code>e</code>, and so on.</p>
  <p>You can find my code for that below.</p>
  <p><strong>My question is:</strong> is there something built-in in python for that? If not, is my
  approach the most efficient?</p>
  <pre><code>def list2bin(e):
  b=[1]
  j=1
  for i in range(1, e[-1]+1):
      if i==e[j]:
          b.append(1)
          j+=1
      else:
          b.append(0)     
  return(b)
  </code></pre>