title: Repeat values in array until specific length
body: <p>I need some kind of function or little tip for my problem.</p>
  <p>So I got a list let's say
  <code>[1,2,3,4]</code>
  but I need this array to be longer with the same elements repeated so let's say I need an array of length 10 so it becomes:
  <code>[1,2,3,4,1,2,3,4,1,2]</code></p>
  <p>So I need to extend the list with the same values as in the list in the same order</p>
  <pre><code>returnString = the array or string to return with extended elements
  array = the basic array which needs to be extended
  length = desired length
  </code></pre>
  <p>EDIT:</p>
  <pre><code>returnString = &quot;&quot;
  array = list(array)
  index = 0
  while len(str(array)) != length:
      if index &lt;= length:
          returnString += array[index]
          index += 1
      else:
          toPut = index % length
          returnString.append(array[toPut])
          index += 1
  return returnString
  </code></pre>