I want replicate a small array to specific length array
Example:
var = [22,33,44,55] # ==> len(var) = 4 n = 13
The new array tha
Copy the array (called lists in python) with [:] because they are mutable. The python short cut is then just to multiply the copy and add one more element.
>>> var = [22, 33, 44, 55] >>> n = 3 >>> newlist = var[:]*n + var[:1]
gives the 13 elements you want.