I am a newbie to Python and have come across the following example in my book that is not explained very well. Here is my print out from the interpreter:
>>> s = 'spam' >>> s[:-1] 'spa'
Why does slicing with no beginning bound and a
'-1' return every element except the last one? Is calling
s[0:-1] logically the same as calling
s[:-1]? They both return the same result. But I'm not sure what python is doing exactly. Any help would be greatly appreciated.