title: Replacing selected elements in a list in Python
body: <p>I have a list: <code>mylist = [0, 0, 0, 0, 0]</code></p>
  
  <p>I only want to replace selected elements, say the first, second, and fourth by a common number, <code>A = 100</code>.</p>
  
  <p>One way to do this:</p>
  
  <pre><code>mylist[:2] = [A]*2
  mylist[3] = A
  mylist
  [100, 100, 0, 100, 0]
  </code></pre>
  
  <p>I am looking for a one-liner, or an easier method to do this. A more general and flexible answer is preferable.</p>