On 2022-10-30 14:57, Yassine Nasri wrote:
Hello,len('') # => 0''[0] # => error''[::] # => ''''[::] # <=> ''[0:len(''):1] the syntax of slice: slice(start, end, step) The start in ''[::] equivalent at index 0 of the '' Since the index 0 of '' returns an error. The ''[::] should not return an error logically.
Python uses half-open ranges. It excludes the end. ''[0:0:1] starts at index 0 but ends at and excludes index 0. -- https://mail.python.org/mailman/listinfo/python-list