The issue here is -0 just is 0, so you're attempting to grab up to the
first character of the string
so for the case of i = 6 you get
test[-2:0] = ''
a better way of handling this is look ahead
for i in range(len(test)-1):
for indexing from the end to work the correct syntax would leave out the
test[-2:] = 'gh'