Are you trying to do this:
text = 'example' result = [ text[i:len(text)-i] for i in range( (len(text)+1)//2 ) ] print(result)
result:
['example', 'xampl', 'amp', 'm']
and if text = 'example1':
'example1'
['example1', 'xample', 'ampl', 'mp']