'How to replace values in a list with an other time increasing list of data

I have a list of data (numbers) comming from a sensor. I need to transforme that data into a list in which i have control, exemple:

values=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]
results=[0]*10

what i need to do is replace results with numbers from values from 1 to 10 and then start replacing de results value from 11 to 20. exemple: results=[1,2,3,4,5,6,7,8,9,10] and then

results=[11,12,13,4,5,6,7,8,9,10]

the code that i have right now is as follows:

from ctypes import sizeof
import time
valores=[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20]
#valores=[1,2,3,4,5,6,7,8,9,10,11,11,12,13,14]
teste =[]
i = 0
#print(len(valores))
for i, x in enumerate(valores):
    if len(teste)<10:
        #print(valores[i])
        teste.insert(i,valores[i])
        time.sleep(1)
        print(teste)
        i = i + 1
    elif len(teste)==10:
        for j, y in enumerate(teste):
            teste[j]=valores[i]
            time.sleep(1)
            print(teste)
            i=i+1
            if i==len(valores):
                break
        break

But i want the teste list to be defined in the beginning



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source