title: Changing the value of alternated rows of a vector in Python
body: <p>Suppose I have the following NumPy array in python:</p>
  <pre><code>V = 2*np.ones([7,1]); V[0]=1; V[6]=1
  </code></pre>
  <p>Which will give me:</p>
  <pre><code>V = ([[1.],
        [2.],
        [2.],
        [2.],
        [2.],
        [2.],
        [1.],])
  </code></pre>
  <p>How can I change only the terms with odd indexes? For example, change the terms on the rows 1,3 and 5, to 4 (counting the first one as row 0) like the one below:</p>
  <pre><code>V = ([[1.],
        [4.],
        [2.],
        [4.],
        [2.],
        [4.],
        [1.],])
  </code></pre>
  <p>Is there a simpler way than to start a loop and check every element one by one? In this problem, I adopted a 7x1 column vector, but I want to solve for the general case of an Nx1 array. Thank you in advance!</p>