Ok so i've searched multiple threads and came across helpful discussion on reversing lists such as this and this; What i did get from those is to use
S = ("hello")
print(S[::-1])
or
S = ("hello")
print(S[len(S):-len(S)-1:-1])
But i don't get the logic behind this! Let's say i want to use
S = ("hello")
print(S[len(S):0:-1])
i will get 'olle' instead of 'olleh', because 0 or 'h' is the 'end' and python stops there; So my intuition would be to get past 0 which is -1 so it will stop at -1 and include 0 as well:
S = ("hello")
print(S[len(S):-1:-1])
but suddenly python doesn't return anything?! Is it because python thinks it's len(S)-1? oh my god.. So what 'IS' in between S[::-1] that makes it works? and how does S[len(S):-len(S)-1:-1] makes sense? -5-1? equals to -6... so
S = ("hello")
S[6:-6:-1]
works... so that means python would include 6, 5 , 4 , 3 , 2 , 1, 0 , -1 , - ,-3 ,-4,-5??