Hello! that code takes the first 80% of the data and puts that into train. Then it skips the first 20% and puts the rest into test. Not how we want it. I’d change the code to something like this
split = round(len(D)*0.8) # The index which marks 80% of the data
train = D[:split] # Takes the first 80% of data
test = D[split:] # Takes whatever is left after the first 80% of data -> last 20% of data